diff --git a/README.md b/README.md index ad437bba..af3cd910 100644 --- a/README.md +++ b/README.md @@ -325,7 +325,7 @@ Notable libraries and software used: * [django-sass](https://github.com/coderedcorp/django-sass/) * The container bundles with `s6-init` and `nginx` -See the [Pipefile](https://github.com/meeb/tubesync/blob/main/Pipfile) for a full list. +See the [Pipfile](https://github.com/meeb/tubesync/blob/main/Pipfile) for a full list. ### Can I get access to the full Django admin? @@ -353,7 +353,12 @@ etc.). Configuration of this is beyond the scope of this README. ### What architectures does the container support? -Just `amd64` for the moment. Others may be made available if there is demand. +Only two are supported, for the moment: +- `amd64` (most desktop PCs and servers) +- `arm64` +(modern ARM computers, such as the Rasperry Pi 3 or later) + +Others may be made available, if there is demand. ### The pipenv install fails with "Locking failed"! diff --git a/tubesync/sync/views.py b/tubesync/sync/views.py index 52090042..8ca853de 100644 --- a/tubesync/sync/views.py +++ b/tubesync/sync/views.py @@ -193,10 +193,15 @@ class ValidateSourceView(FormView): Source.SOURCE_TYPE_YOUTUBE_PLAYLIST: ('https://www.youtube.com/playlist?list=' 'PL590L5WQmH8dpP0RyH5pCfIaDEdt9nk7r') } + _youtube_domains = frozenset({ + 'youtube.com', + 'm.youtube.com', + 'www.youtube.com', + }) validation_urls = { Source.SOURCE_TYPE_YOUTUBE_CHANNEL: { 'scheme': 'https', - 'domains': ('m.youtube.com', 'www.youtube.com'), + 'domains': _youtube_domains, 'path_regex': '^\/(c\/)?([^\/]+)(\/videos)?$', 'path_must_not_match': ('/playlist', '/c/playlist'), 'qs_args': [], @@ -205,7 +210,7 @@ class ValidateSourceView(FormView): }, Source.SOURCE_TYPE_YOUTUBE_CHANNEL_ID: { 'scheme': 'https', - 'domains': ('m.youtube.com', 'www.youtube.com'), + 'domains': _youtube_domains, 'path_regex': '^\/channel\/([^\/]+)(\/videos)?$', 'path_must_not_match': ('/playlist', '/c/playlist'), 'qs_args': [], @@ -214,7 +219,7 @@ class ValidateSourceView(FormView): }, Source.SOURCE_TYPE_YOUTUBE_PLAYLIST: { 'scheme': 'https', - 'domains': ('m.youtube.com', 'www.youtube.com'), + 'domains': _youtube_domains, 'path_regex': '^\/(playlist|watch)$', 'path_must_not_match': (), 'qs_args': ('list',), diff --git a/tubesync/tubesync/wsgi.py b/tubesync/tubesync/wsgi.py index 71c61003..74912aef 100644 --- a/tubesync/tubesync/wsgi.py +++ b/tubesync/tubesync/wsgi.py @@ -1,5 +1,4 @@ import os -from urllib.parse import urljoin from django.core.wsgi import get_wsgi_application @@ -16,10 +15,9 @@ def application(environ, start_response): else: raise Exception(f'DJANGO_URL_PREFIX must end with a /, ' f'got: {DJANGO_URL_PREFIX}') - if script_name: - static_url = urljoin(script_name, 'static/') + if script_name is not None: environ['SCRIPT_NAME'] = script_name path_info = environ['PATH_INFO'] - if path_info.startswith(script_name) and not path_info.startswith(static_url): + if path_info.startswith(script_name): environ['PATH_INFO'] = path_info[len(script_name) - 1:] return _application(environ, start_response) diff --git a/tubesync/upgrade_yt-dlp.sh b/tubesync/upgrade_yt-dlp.sh new file mode 100755 index 00000000..9da6d555 --- /dev/null +++ b/tubesync/upgrade_yt-dlp.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash + +warning_message() { + cat <&2 + +pip3() { + local pip_runner pip_whl run_whl + + # pipenv + pip_runner='/usr/lib/python3/dist-packages/pipenv/patched/pip/__pip-runner__.py' + test -s "${pip_runner}" || pip_runner='' + + # python3-pip-whl + pip_whl="$(ls -1r /usr/share/python-wheels/pip-*-py3-none-any.whl | head -n 1)" + run_whl="${pip_whl}/pip" + + python3 "${pip_runner:-"${run_whl}"}" "$@" +} + +warning_message +test -n "${TUBESYNC_DEBUG}" || exit 1 + +# Use the flag added in 23.0.1, if possible. +# https://github.com/pypa/pip/pull/11780 +break_system_packages='--break-system-packages' +pip_version="$(pip3 --version | awk '$1 = "pip" { print $2; exit; }')" +if [[ "${pip_version}" < "23.0.1" ]]; then + break_system_packages='' +fi + +pip3 install --upgrade ${break_system_packages} yt-dlp +