fix precommit yaml

This commit is contained in:
Your Name 2023-08-10 16:01:40 -04:00 committed by Henri Dickson
parent c3d9c4cc4b
commit a69fc2ac4b
11 changed files with 109 additions and 96 deletions

View file

@ -48,11 +48,11 @@ jobs:
# If you wish to specify custom queries, you can do so here or in a config file. # If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file. # By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file. # Prefix the list here with "+" to use these queries and those in the config file.
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality # queries: security-extended,security-and-quality
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below) # If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild - name: Autobuild
@ -61,7 +61,7 @@ jobs:
# Command-line programs to run using the OS shell. # Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
# If the Autobuild fails above, remove it and uncomment the following three lines. # If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
# - run: | # - run: |

View file

@ -1,24 +1,39 @@
exclude: ^test_data/
repos: repos:
- repo: https://github.com/pre-commit/pre-commit-hooks - repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0 rev: v4.4.0
hooks: hooks:
- id: check-yaml - id: check-yaml
- id: check-json
- id: check-xml
- id: check-toml
- id: check-symlinks
- id: check-added-large-files
args: [--maxkb=1024]
- id: detect-private-key
- id: end-of-file-fixer
- id: fix-byte-order-marker
- id: debug-statements
- id: check-merge-conflict
- id: end-of-file-fixer - id: end-of-file-fixer
- id: trailing-whitespace - id: trailing-whitespace
- repo: https://github.com/psf/black - id: requirements-txt-fixer
rev: 22.12.0 - id: mixed-line-ending
hooks:
- id: black
language_version: python3.11
repos:
- repo: https://github.com/Riverside-Healthcare/djLint
rev: v1.32.1
hooks:
- id: djlint-reformat-django
- id: djlint-django
- repo: https://github.com/pycqa/isort - repo: https://github.com/pycqa/isort
rev: 5.12.0 rev: 5.12.0
hooks: hooks:
- id: isort - id: isort
args: ["--profile=black"] args: ["--profile=black"]
- repo: https://github.com/psf/black
rev: 22.12.0
hooks:
- id: black
language_version: python3.11
- repo: https://github.com/Riverside-Healthcare/djLint
rev: v1.32.1
hooks:
- id: djlint-reformat-django
- id: djlint-django

View file

@ -2,13 +2,13 @@
FROM python:3.8-slim FROM python:3.8-slim
ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1 ENV PYTHONUNBUFFERED=1
RUN apt-get update \ RUN apt-get update \
&& apt-get install -y --no-install-recommends build-essential libpq-dev git \ && apt-get install -y --no-install-recommends build-essential libpq-dev git \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
COPY requirements.txt /tmp/requirements.txt COPY requirements.txt /tmp/requirements.txt
RUN pip install --no-cache-dir -r /tmp/requirements.txt \ RUN pip install --no-cache-dir -r /tmp/requirements.txt \
&& rm -rf /tmp/requirements.txt \ && rm -rf /tmp/requirements.txt \
&& useradd -U app_user \ && useradd -U app_user \
&& install -d -m 0755 -o app_user -g app_user /app/static && install -d -m 0755 -o app_user -g app_user /app/static
ENV DJANGO_SETTINGS_MODULE=yoursettings.dev ENV DJANGO_SETTINGS_MODULE=yoursettings.dev
@ -17,7 +17,7 @@ USER app_user:app_user
COPY --chown=app_user:app_user . . COPY --chown=app_user:app_user . .
RUN chmod +x docker/*.sh RUN chmod +x docker/*.sh
# Section 6- Docker Run Checks and Configurations # Section 6- Docker Run Checks and Configurations
ENTRYPOINT [ "docker/entrypoint.sh" ] ENTRYPOINT [ "docker/entrypoint.sh" ]
CMD [ "docker/start.sh", "server" ] CMD [ "docker/start.sh", "server" ]

View file

@ -29,7 +29,7 @@
}); });
$(this).remove(); $(this).remove();
}) })
</script> </script>
{% endif %} {% endif %}
{% endif %} {% endif %}

View file

@ -2,4 +2,4 @@
<g> <g>
<path d="m464.16327,0q-32,0 -55,22t-25,55t20.5,58t56,27t58.5,-20.5t27,-56t-20.5,-59t-56.5,-26.5l-5,0zm-87,95l-232,118q20,20 25,48l231,-118q-19,-20 -24,-48zm167,27q-13,25 -38,38l183,184q13,-25 39,-38l-184,-184zm-142,22l-135,265l40,40l143,-280q-28,-5 -48,-25zm104,16q-22,11 -46,10l-8,-1l21,132l56,9l-23,-150zm-426,34q-32,0 -55,22.5t-25,55t20.5,58t56.5,27t59,-21t26.5,-56t-21,-58.5t-55.5,-27l-6,0zm90,68q1,9 1,18q-1,19 -10,35l132,21l26,-50l-149,-24zm225,36l-26,51l311,49q-1,-8 -1,-17q1,-19 10,-36l-294,-47zm372,6q-32,1 -55,23t-24.5,55t21,58t56,27t58.5,-20.5t27,-56.5t-20.5,-59t-56.5,-27l-6,0zm-606,13q-13,25 -39,38l210,210l51,-25l-222,-223zm-40,38q-21,11 -44,10l-9,-1l40,256q21,-10 45,-9l8,1l-40,-257zm364,22l48,311q21,-10 44,-9l10,1l-46,-294l-56,-9zm195,23l-118,60l8,56l135,-68q-20,-20 -25,-48zm26,49l-119,231q28,5 48,25l119,-231q-28,-5 -48,-25zm-475,29l-68,134q28,5 48,25l60,-119l-40,-40zm262,17l-281,143q19,20 24,48l265,-135l-8,-56zm-55,100l-51,25l106,107q13,-25 39,-38l-94,-94zm-291,24q-32,0 -55.5,22.5t-25,55t21,57.5t56,27t58.5,-20.5t27,-56t-20.5,-58.5t-56.5,-27l-5,0zm89,68q2,9 1,18q-1,19 -9,35l256,41q-1,-9 -1,-18q1,-18 10,-35l-257,-41zm335,0q-32,0 -55,22.5t-24.5,55t20.5,58t56,27t59,-21t27,-56t-20.5,-58.5t-56.5,-27l-6,0z"/> <path d="m464.16327,0q-32,0 -55,22t-25,55t20.5,58t56,27t58.5,-20.5t27,-56t-20.5,-59t-56.5,-26.5l-5,0zm-87,95l-232,118q20,20 25,48l231,-118q-19,-20 -24,-48zm167,27q-13,25 -38,38l183,184q13,-25 39,-38l-184,-184zm-142,22l-135,265l40,40l143,-280q-28,-5 -48,-25zm104,16q-22,11 -46,10l-8,-1l21,132l56,9l-23,-150zm-426,34q-32,0 -55,22.5t-25,55t20.5,58t56.5,27t59,-21t26.5,-56t-21,-58.5t-55.5,-27l-6,0zm90,68q1,9 1,18q-1,19 -10,35l132,21l26,-50l-149,-24zm225,36l-26,51l311,49q-1,-8 -1,-17q1,-19 10,-36l-294,-47zm372,6q-32,1 -55,23t-24.5,55t21,58t56,27t58.5,-20.5t27,-56.5t-20.5,-59t-56.5,-27l-6,0zm-606,13q-13,25 -39,38l210,210l51,-25l-222,-223zm-40,38q-21,11 -44,10l-9,-1l40,256q21,-10 45,-9l8,1l-40,-257zm364,22l48,311q21,-10 44,-9l10,1l-46,-294l-56,-9zm195,23l-118,60l8,56l135,-68q-20,-20 -25,-48zm26,49l-119,231q28,5 48,25l119,-231q-28,-5 -48,-25zm-475,29l-68,134q28,5 48,25l60,-119l-40,-40zm262,17l-281,143q19,20 24,48l265,-135l-8,-56zm-55,100l-51,25l106,107q13,-25 39,-38l-94,-94zm-291,24q-32,0 -55.5,22.5t-25,55t21,57.5t56,27t58.5,-20.5t27,-56t-20.5,-58.5t-56.5,-27l-5,0zm89,68q2,9 1,18q-1,19 -9,35l256,41q-1,-9 -1,-18q1,-18 10,-35l-257,-41zm335,0q-32,0 -55,22.5t-24.5,55t20.5,58t56,27t59,-21t27,-56t-20.5,-58.5t-56.5,-27l-6,0z"/>
</g> </g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View file

@ -112,4 +112,3 @@ Add a new site
- Command: `python3 manage.py test [--keepdb]`. More detailed for `test`, please check [this doc](https://github.com/neodb-social/neodb/blob/main/doc/development.md#run-test) - Command: `python3 manage.py test [--keepdb]`. More detailed for `test`, please check [this doc](https://github.com/neodb-social/neodb/blob/main/doc/development.md#run-test)
- See [this issue](https://github.com/neodb-social/neodb/issues/5) if `lxml.etree.ParserError` occurs on macOS. - See [this issue](https://github.com/neodb-social/neodb/issues/5) if `lxml.etree.ParserError` occurs on macOS.
- add a site UI label to `common/static/scss/_sitelabel.scss` - add a site UI label to `common/static/scss/_sitelabel.scss`

View file

@ -42,7 +42,7 @@ SECRET_KEY = "my_key"
The most important configurations to setup are: The most important configurations to setup are:
- `MASTODON_ALLOW_ANY_SITE` set to `True` so that user can login via any Mastodon API compatible sites (e.g. Mastodon/Pleroma) - `MASTODON_ALLOW_ANY_SITE` set to `True` so that user can login via any Mastodon API compatible sites (e.g. Mastodon/Pleroma)
- `REDIRECT_URIS` should be `SITE_INFO["site_url"] + "/account/login/oauth"`. If you want to run **on local**, `SITE_INFO["site_url"]` should be set to `"http://localhost/"` - `REDIRECT_URIS` should be `SITE_INFO["site_url"] + "/account/login/oauth"`. If you want to run **on local**, `SITE_INFO["site_url"]` should be set to `"http://localhost/"`
More details on `settings.py` in [configuration.md](configuration.md) More details on `settings.py` in [configuration.md](configuration.md)
@ -89,7 +89,7 @@ python3 manage.py runserver
It should be ready to serve from here, to run web server for production, consider `gunicorn -w 8 boofilsic.wsgi` in systemd or sth similar It should be ready to serve from here, to run web server for production, consider `gunicorn -w 8 boofilsic.wsgi` in systemd or sth similar
3 Migrate from an earlier version 3 Migrate from an earlier version
------------------------------- -------------------------------
Update database Update database
``` ```
@ -145,9 +145,9 @@ python3 manage.py createapplication --client-id NEODB_DEVELOPER_CONSOLE --skip-a
### I got Error: “无效的登录回调地址”. ### I got Error: “无效的登录回调地址”.
Check `REDIRECT_URIS` in `settings.py`, the final value should be `"http://localhost/account/login/oauth"` or sth similar. If you are specifying a port, add the port to the localhost address. Check `REDIRECT_URIS` in `settings.py`, the final value should be `"http://localhost/account/login/oauth"` or sth similar. If you are specifying a port, add the port to the localhost address.
If any change was made to `REDIRECT_URIS`, existing apps registered in Mastodon are no longer valid, so delete the app record in the database: If any change was made to `REDIRECT_URIS`, existing apps registered in Mastodon are no longer valid, so delete the app record in the database:
``` ```
delete from mastodon_mastodonapplication; delete from mastodon_mastodonapplication;
``` ```

View file

@ -1,12 +1,12 @@
#!/bin/bash #!/bin/bash
set -o errexit set -o errexit
set -o pipefail set -o pipefail
set -o nounset set -o nounset
python manage.py collectstatic --noinput python manage.py collectstatic --noinput
python manage.py makemigrations users books movies games music sync mastodon management collection python manage.py makemigrations users books movies games music sync mastodon management collection
python manage.py makemigrations python manage.py makemigrations
python manage.py migrate users python manage.py migrate users
python manage.py migrate python manage.py migrate

View file

@ -1,36 +1,35 @@
#!/bin/bash #!/bin/bash
cd /app cd /app
if [ $# -eq 0 ]; then if [ $# -eq 0 ]; then
echo "Usage: start.sh <server|rq>" echo "Usage: start.sh <server|rq>"
exit 1 exit 1
fi fi
PROCESS_TYPE=$1 PROCESS_TYPE=$1
if [ "$PROCESS_TYPE" = "server" ]; then if [ "$PROCESS_TYPE" = "server" ]; then
if [ "$DJANGO_DEBUG" = "true" ]; then if [ "$DJANGO_DEBUG" = "true" ]; then
gunicorn \ gunicorn \
--reload \ --reload \
--bind 0.0.0.0:8000 \ --bind 0.0.0.0:8000 \
--workers 2 \ --workers 2 \
--worker-class eventlet \ --worker-class eventlet \
--log-level DEBUG \ --log-level DEBUG \
--access-logfile "-" \ --access-logfile "-" \
--error-logfile "-" \ --error-logfile "-" \
boofilsic.wsgi
else
gunicorn \
--bind 0.0.0.0:8000 \
--workers 2 \
--worker-class eventlet \
--log-level DEBUG \
--access-logfile "-" \
--error-logfile "-" \
boofilsic.wsgi boofilsic.wsgi
fi else
gunicorn \
--bind 0.0.0.0:8000 \
--workers 2 \
--worker-class eventlet \
--log-level DEBUG \
--access-logfile "-" \
--error-logfile "-" \
boofilsic.wsgi
fi
elif [ "$PROCESS_TYPE" = "rq" ]; then elif [ "$PROCESS_TYPE" = "rq" ]; then
rqworker --with-scheduler doufen export mastodon rqworker --with-scheduler doufen export mastodon
fi fi

View file

@ -1,8 +1,8 @@
pre-commit~=3.3.3
isort~=5.12.0
black~=22.12.0 black~=22.12.0
django-debug-toolbar
coverage coverage
django-debug-toolbar
djlint~=1.32.1 djlint~=1.32.1
isort~=5.12.0
pre-commit~=3.3.3
types-dateparser types-dateparser
types-tqdm types-tqdm

View file

@ -1,42 +1,42 @@
dateparser dateparser
mistune discord.py
rq>=1.12.0
django~=4.2.4 django~=4.2.4
django-auditlog
django-markdownx @ git+https://github.com/alphatownsman/django-markdownx.git@e69480c64ad9c5d0499f4a8625da78cf2bb7691b
django-jsonform
libsass
django-compressor
django-sass-processor
django-rq
django-simple-history # no longer used but kept for migration code which is used by tests
django-auditlog @ git+https://github.com/jazzband/django-auditlog.git@45591463e8192b4ac0095e259cc4dcea0ac2fd6c
django-hijack
django-user-messages
django-slack
django-ninja
django-polymorphic
django-maintenance-mode
django-tz-detect
django-bleach
django-redis
django-oauth-toolkit
django-anymail django-anymail
django-auditlog
django-auditlog @ git+https://github.com/jazzband/django-auditlog.git@45591463e8192b4ac0095e259cc4dcea0ac2fd6c
django-bleach
django-compressor
django-hijack
django-jsonform
django-maintenance-mode
django-markdownx @ git+https://github.com/alphatownsman/django-markdownx.git@e69480c64ad9c5d0499f4a8625da78cf2bb7691b
django-ninja
django-oauth-toolkit
django-polymorphic
django-redis
django-rq
django-sass-processor
django-simple-history # no longer used but kept for migration code which is used by tests
django-slack
django-tz-detect
django-user-messages
dnspython
easy-thumbnails easy-thumbnails
filetype
fontawesomefree
igdb-api-v4
libsass
listparser
loguru
lxml lxml
markdownify
mistune
opencc
openpyxl openpyxl
podcastparser
psycopg2-binary psycopg2-binary
requests requests
filetype rq>=1.12.0
setproctitle setproctitle
tqdm tqdm
opencc
dnspython
typesense typesense
markdownify
igdb-api-v4
podcastparser
listparser
fontawesomefree
discord.py
loguru