From cc22ffe6df0f6ec7467ef902ad16b968adda456f Mon Sep 17 00:00:00 2001 From: Bruno Charest Date: Sun, 21 Jun 2026 23:12:45 -0400 Subject: [PATCH] =?UTF-8?q?fix:=20SW-killer=20script=20in=20index.html=20?= =?UTF-8?q?=E2=80=94=20auto-unregister=20stale=20Service=20Worker?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The SW was the root cause of all persistent French text issues. Even after rebuild, browsers with a registered SW would serve cached old files (viewer.js without data-i18n, old locale JSONs). SW-killer runs before any module script: 1. Detects if SW is controlling the page 2. Unregisters all SW registrations 3. Clears all caches 4. Reloads the page once (sessionStorage flag to prevent loop) Other fixes in this commit: - auth.js: import setLocale statically (was dynamic import) - auth.js: import loadVaults/loadTags from sidebar.js - sw.js: add JS modules + locales to STATIC_ASSETS for versioning - sw.js: CACHE_VERSION v4→v5 --- frontend/index.html | 4 ++++ frontend/js/auth.js | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/frontend/index.html b/frontend/index.html index 787a679..c1cecd5 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -4651,6 +4651,10 @@ curl -X POST https://votre-serveur.com/webhook \ + diff --git a/frontend/js/auth.js b/frontend/js/auth.js index 554460c..621254d 100644 --- a/frontend/js/auth.js +++ b/frontend/js/auth.js @@ -2,7 +2,7 @@ import { state } from './state.js'; import { safeCreateIcons } from './utils.js'; import { showToast, closeHeaderMenu } from './ui.js'; -import { t, getLocale } from './i18n.js'; +import { t, getLocale, setLocale } from './i18n.js'; import { showWelcome } from './viewer.js'; import { loadVaults, loadTags } from './sidebar.js'; @@ -310,7 +310,6 @@ function initLoginForm() { if (resp.ok) { const user = await resp.json(); if (user.language && user.language !== getLocale()) { - const { setLocale } = await import('./i18n.js'); await setLocale(user.language); } }