From 66ef7a73321dda1318b610a17794c7a5d74176d6 Mon Sep 17 00:00:00 2001 From: Eliot Berriot Date: Wed, 16 Oct 2019 10:21:53 +0200 Subject: [PATCH 1/8] Fix #946: Fix import crash when importing M4A file with no embedded cover --- api/funkwhale_api/music/metadata.py | 2 +- api/tests/music/test_metadata.py | 5 +++++ changes/changelog.d/946.bugfix | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 changes/changelog.d/946.bugfix diff --git a/api/funkwhale_api/music/metadata.py b/api/funkwhale_api/music/metadata.py index 801ea6a9b..d22f637fd 100644 --- a/api/funkwhale_api/music/metadata.py +++ b/api/funkwhale_api/music/metadata.py @@ -72,7 +72,7 @@ def clean_id3_pictures(apic): def get_mp4_tag(f, k): if k == "pictures": - return f.get("covr") + return f.get("covr", []) raw_value = f.get(k, None) if not raw_value: diff --git a/api/tests/music/test_metadata.py b/api/tests/music/test_metadata.py index 9a3826ce3..6c9b03846 100644 --- a/api/tests/music/test_metadata.py +++ b/api/tests/music/test_metadata.py @@ -219,6 +219,11 @@ def test_can_get_metadata_from_m4a_file(field, value): assert data.get(field) == value +def test_get_pictures_m4a_empty(): + pictures = metadata.get_mp4_tag({}, "pictures") + assert metadata.clean_mp4_pictures(pictures) == [] + + def test_can_get_metadata_from_flac_file_not_crash_if_empty(): path = os.path.join(DATA_DIR, "sample.flac") data = metadata.Metadata(path) diff --git a/changes/changelog.d/946.bugfix b/changes/changelog.d/946.bugfix new file mode 100644 index 000000000..9f6998306 --- /dev/null +++ b/changes/changelog.d/946.bugfix @@ -0,0 +1 @@ +Fix import crash when importing M4A file with no embedded cover (#946) From 6a389e902a377a6f44a3b0fe74356074ce0d2a94 Mon Sep 17 00:00:00 2001 From: Eliot Berriot Date: Wed, 16 Oct 2019 12:18:38 +0200 Subject: [PATCH 2/8] Fixed style glitches in dropdowns --- changes/changelog.d/css-dropdown.bugfix | 1 + front/vue.config.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 changes/changelog.d/css-dropdown.bugfix diff --git a/changes/changelog.d/css-dropdown.bugfix b/changes/changelog.d/css-dropdown.bugfix new file mode 100644 index 000000000..259731bdd --- /dev/null +++ b/changes/changelog.d/css-dropdown.bugfix @@ -0,0 +1 @@ +Fixed style glitches in dropdowns diff --git a/front/vue.config.js b/front/vue.config.js index 7c3d47ef4..a2c6b711d 100644 --- a/front/vue.config.js +++ b/front/vue.config.js @@ -21,7 +21,7 @@ plugins.push( ]), whitelist: ['scale'], whitelistPatterns:[/plyr/], - whitelistPatternsChildren:[/plyr/] + whitelistPatternsChildren:[/plyr/, /dropdown/] }), ) module.exports = { From 7504ec097f05c1f2745ec56d14779c6abd657063 Mon Sep 17 00:00:00 2001 From: Eliot Berriot Date: Wed, 16 Oct 2019 14:14:46 +0200 Subject: [PATCH 3/8] Added link to third-party helm chart --- docs/installation/index.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/installation/index.rst b/docs/installation/index.rst index 1b097cd48..047f8739f 100644 --- a/docs/installation/index.rst +++ b/docs/installation/index.rst @@ -47,6 +47,7 @@ Funkwhale packages are available for the following platforms: - `YunoHost 3 `_: https://github.com/YunoHost-Apps/funkwhale_ynh (kindly maintained by `@Jibec `_) - ArchLinux (as an AUR package): if you'd rather use a package, check out this alternative installation method on ArchLinux: https://wiki.archlinux.org/index.php/Funkwhale (package and wiki kindly maintained by getzee) - `NixOS `_ (kindly maintained by @mmai) +- `Helm chart `_ to install Funkwhale on Kubenertes (kindly maintained by @ananace) Project architecture -------------------- From 4a5484c7eb45c43194f5eeb8395b5137e466f6dd Mon Sep 17 00:00:00 2001 From: Eliot Berriot Date: Wed, 16 Oct 2019 15:10:13 +0200 Subject: [PATCH 4/8] Fix audio serving issues under S3/nginx when signatures are enabled --- api/funkwhale_api/music/views.py | 4 ++++ api/tests/music/test_views.py | 12 ++++++++++++ changes/changelog.d/s3-proxy.bugfix | 1 + 3 files changed, 17 insertions(+) create mode 100644 changes/changelog.d/s3-proxy.bugfix diff --git a/api/funkwhale_api/music/views.py b/api/funkwhale_api/music/views.py index c0effbac2..9de785116 100644 --- a/api/funkwhale_api/music/views.py +++ b/api/funkwhale_api/music/views.py @@ -320,6 +320,10 @@ def get_file_path(audio_file): ) path = "/music" + audio_file.replace(prefix, "", 1) if path.startswith("http://") or path.startswith("https://"): + protocol, remainder = path.split("://", 1) + hostname, r_path = remainder.split("/", 1) + r_path = urllib.parse.quote(r_path) + path = protocol + "://" + hostname + "/" + r_path return (settings.PROTECT_FILES_PATH + "/media/" + path).encode("utf-8") # needed to serve files with % or ? chars path = urllib.parse.quote(path) diff --git a/api/tests/music/test_views.py b/api/tests/music/test_views.py index 0339437d4..22f7da635 100644 --- a/api/tests/music/test_views.py +++ b/api/tests/music/test_views.py @@ -247,6 +247,18 @@ def test_serve_file_in_place_nginx_encode_url( assert response["X-Accel-Redirect"] == expected +def test_serve_s3_nginx_encode_url(mocker, settings): + settings.PROTECT_FILE_PATH = "/_protected/media" + settings.REVERSE_PROXY_TYPE = "nginx" + audio_file = mocker.Mock(url="https://s3.storage.example/path/to/mp3?aws=signature") + + expected = ( + b"/_protected/media/https://s3.storage.example/path/to/mp3%3Faws%3Dsignature" + ) + + assert views.get_file_path(audio_file) == expected + + @pytest.mark.parametrize( "proxy,serve_path,expected", [ diff --git a/changes/changelog.d/s3-proxy.bugfix b/changes/changelog.d/s3-proxy.bugfix new file mode 100644 index 000000000..0afe65caf --- /dev/null +++ b/changes/changelog.d/s3-proxy.bugfix @@ -0,0 +1 @@ +Fix audio serving issues under S3/nginx when signatures are enabled From bd3a4b4406ff6f42acd9628317dc29d49562aa8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciar=C3=A1n=20Ainsworth?= Date: Thu, 17 Oct 2019 10:18:55 +0200 Subject: [PATCH 5/8] Add new whitlisted class for upward menus --- front/vue.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/front/vue.config.js b/front/vue.config.js index a2c6b711d..b4be29122 100644 --- a/front/vue.config.js +++ b/front/vue.config.js @@ -21,7 +21,7 @@ plugins.push( ]), whitelist: ['scale'], whitelistPatterns:[/plyr/], - whitelistPatternsChildren:[/plyr/, /dropdown/] + whitelistPatternsChildren:[/plyr/,/dropdown/,/upward/] }), ) module.exports = { From 28b334ad33ce3bd8a10a4333557b15e872bb0142 Mon Sep 17 00:00:00 2001 From: Eliot Berriot Date: Thu, 17 Oct 2019 14:39:06 +0200 Subject: [PATCH 6/8] Reduce DB connection leaks --- api/compose/django/server.sh | 2 +- api/config/asgi.py | 1 + api/config/settings/common.py | 2 +- changes/changelog.d/db.enhancement | 1 + 4 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 changes/changelog.d/db.enhancement diff --git a/api/compose/django/server.sh b/api/compose/django/server.sh index 0e4c737af..9c7709516 100755 --- a/api/compose/django/server.sh +++ b/api/compose/django/server.sh @@ -1,3 +1,3 @@ #!/bin/bash -eux python /app/manage.py collectstatic --noinput -gunicorn config.asgi:application -w ${FUNKWHALE_WEB_WORKERS-1} -k uvicorn.workers.UvicornWorker -b 0.0.0.0:5000 +gunicorn config.asgi:application -w ${FUNKWHALE_WEB_WORKERS-1} -k uvicorn.workers.UvicornWorker -b 0.0.0.0:5000 ${GUNICORN_ARGS-} diff --git a/api/config/asgi.py b/api/config/asgi.py index b4a8105de..d578a3bff 100644 --- a/api/config/asgi.py +++ b/api/config/asgi.py @@ -1,6 +1,7 @@ import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.production") +os.environ.setdefault("ASGI_THREADS", "5") import django # noqa diff --git a/api/config/settings/common.py b/api/config/settings/common.py index a20081dd2..43a7a29f5 100644 --- a/api/config/settings/common.py +++ b/api/config/settings/common.py @@ -270,7 +270,7 @@ DATABASES = { "default": env.db("DATABASE_URL") } DATABASES["default"]["ATOMIC_REQUESTS"] = True -DATABASES["default"]["CONN_MAX_AGE"] = env("DB_CONN_MAX_AGE", default=60 * 60) +DATABASES["default"]["CONN_MAX_AGE"] = env("DB_CONN_MAX_AGE", default=60 * 5) MIGRATION_MODULES = { # see https://github.com/jazzband/django-oauth-toolkit/issues/634 diff --git a/changes/changelog.d/db.enhancement b/changes/changelog.d/db.enhancement new file mode 100644 index 000000000..da25ea858 --- /dev/null +++ b/changes/changelog.d/db.enhancement @@ -0,0 +1 @@ +Reduce the number of simultaneous DB connections under some deployment scenario From 02debeb98b7343e0d63039f043b52426707ccec9 Mon Sep 17 00:00:00 2001 From: Eliot Berriot Date: Thu, 17 Oct 2019 15:19:08 +0200 Subject: [PATCH 7/8] Resolve "Library Upload: missing retry upload button" --- changes/changelog.d/942.enhancement | 1 + front/src/components/library/FileUpload.vue | 47 ++++++++++++++++++--- 2 files changed, 43 insertions(+), 5 deletions(-) create mode 100644 changes/changelog.d/942.enhancement diff --git a/changes/changelog.d/942.enhancement b/changes/changelog.d/942.enhancement new file mode 100644 index 000000000..66a1bfff3 --- /dev/null +++ b/changes/changelog.d/942.enhancement @@ -0,0 +1 @@ +Added a retry option for failed uploads (#942) diff --git a/front/src/components/library/FileUpload.vue b/front/src/components/library/FileUpload.vue index d88efd5ab..9e86600b3 100644 --- a/front/src/components/library/FileUpload.vue +++ b/front/src/components/library/FileUpload.vue @@ -91,9 +91,20 @@ - + + + + + + + + @@ -113,9 +124,20 @@ Uploading… ({{ parseInt(file.progress) }}%) - diff --git a/front/src/components/audio/track/Widget.vue b/front/src/components/audio/track/Widget.vue index 788d279d0..235659564 100644 --- a/front/src/components/audio/track/Widget.vue +++ b/front/src/components/audio/track/Widget.vue @@ -7,7 +7,7 @@ -
+
@@ -51,6 +51,17 @@
+
+
+ + + Nothing found + +
+
+
+
+
diff --git a/front/src/components/favorites/List.vue b/front/src/components/favorites/List.vue index 6402d417f..f7d37369c 100644 --- a/front/src/components/favorites/List.vue +++ b/front/src/components/favorites/List.vue @@ -18,7 +18,7 @@ -
+
@@ -46,7 +46,6 @@
-
+
+
+ + No tracks have been added to your favorites yet +
+ + + Browse the library + +
diff --git a/front/src/components/library/Albums.vue b/front/src/components/library/Albums.vue index 7aad836f0..07e20b22e 100644 --- a/front/src/components/library/Albums.vue +++ b/front/src/components/library/Albums.vue @@ -59,6 +59,23 @@ :key="album.id" :album="album">
+
+
+ + + No results matching your query + +
+ + + + Add some music + + +
+
+
+ + + No results matching your query + +
+ + + + Add some music + + +
+
+
+ + + No results matching your query + +
+ + + + Create a radio + + +
-
+
-
+
@@ -90,6 +90,12 @@
+
+
+ + No interactions with other pods yet +
+
diff --git a/front/src/views/playlists/Detail.vue b/front/src/views/playlists/Detail.vue index 3b6b9000b..5dc99e78b 100644 --- a/front/src/views/playlists/Detail.vue +++ b/front/src/views/playlists/Detail.vue @@ -55,7 +55,6 @@
-
@@ -64,7 +63,6 @@
-
- diff --git a/front/src/views/playlists/List.vue b/front/src/views/playlists/List.vue index 1ff56b5d5..9fb53fd66 100644 --- a/front/src/views/playlists/List.vue +++ b/front/src/views/playlists/List.vue @@ -40,7 +40,24 @@
- + +
+
+ + + No results matching your query + +
+ +
-
+

Tracks

@@ -44,6 +44,21 @@ >
+
+
+ + No tracks have been added to this radio yet +
+ + + Edit… + +
FilenameFilename Size StatusActions
+ +