From a29293bd7ed5a2aa047d968e32059456a804c2f1 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 10 Nov 2026 15:48:32 -0500 Subject: [PATCH] Bump the service worker's index.html revision after injecting Funkwhale's service worker precaches index.html by a build-time revision, so returning visitors kept the unmodified page. inject.sh now writes the modified page's hash into serviceWorker.js, which makes browsers install the updated worker and fetch the new page. Co-Authored-By: Claude Opus 5.5 --- README.md | 2 +- funkwhale_oidc/__init__.py | 2 +- funkwhale_oidc/front/inject.sh | 9 +++++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 130a38d..13354af 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Install the package and PyJWT into `FUNKWHALE_PLUGINS_PATH` (default `/srv/funkw ```sh pip install --target /srv/funkwhale/plugins \ - https://gitea.eom.dev/DevOps/funkwhale-oidc/archive/v0.2.0.tar.gz + https://gitea.eom.dev/DevOps/funkwhale-oidc/archive/v0.2.1.tar.gz ``` In containers, run this as an init step into a shared volume. `tests/compose.yaml` shows how. diff --git a/funkwhale_oidc/__init__.py b/funkwhale_oidc/__init__.py index 693162a..b1ee809 100644 --- a/funkwhale_oidc/__init__.py +++ b/funkwhale_oidc/__init__.py @@ -1,4 +1,4 @@ # SPDX-License-Identifier: AGPL-3.0-or-later """OpenID Connect login for Funkwhale, as a Funkwhale plugin.""" -__version__ = "0.2.0" +__version__ = "0.2.1" diff --git a/funkwhale_oidc/front/inject.sh b/funkwhale_oidc/front/inject.sh index 593ee5f..6f963c7 100755 --- a/funkwhale_oidc/front/inject.sh +++ b/funkwhale_oidc/front/inject.sh @@ -23,3 +23,12 @@ if ! grep -q 'location /accounts/' "$conf"; then grep -q 'location /accounts/' "$conf" || { echo "funkwhale-oidc: could not add /accounts/ to $conf" >&2; exit 1; } echo "funkwhale-oidc: /accounts/ proxied to the API" fi + +# The web app's service worker precaches index.html by the revision in its +# manifest; without a new revision, returning visitors keep the old page. +sw=/usr/share/nginx/html/serviceWorker.js +if [ -f "$sw" ]; then + rev=$(md5sum "$index" | cut -c1-32) + sed -i "s|\"revision\":\"[0-9a-f]*\",\"url\":\"index.html\"|\"revision\":\"$rev\",\"url\":\"index.html\"|" "$sw" + grep -q "\"revision\":\"$rev\",\"url\":\"index.html\"" "$sw" && echo "funkwhale-oidc: service worker revision for index.html set to $rev" +fi