From 11067d9ef8a6ac0484bc8b08eeff3b747fedf9ec Mon Sep 17 00:00:00 2001 From: rene Date: Wed, 6 May 2026 18:50:54 +0200 Subject: [PATCH] =?UTF-8?q?Fix:=20Update-Button=20leert=20SW-Cache=20vor?= =?UTF-8?q?=20Reload,=20Fallback-Text=20f=C3=BCr=20Desktop=20(Cmd+Shift+R)?= =?UTF-8?q?=20(SW=20by-v736)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/main.py | 2 +- backend/static/index.html | 2 +- backend/static/js/app.js | 18 ++++++++---------- backend/static/sw.js | 2 +- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/backend/main.py b/backend/main.py index 35a8577..9c00a1b 100644 --- a/backend/main.py +++ b/backend/main.py @@ -327,7 +327,7 @@ MEDIA_DIR = os.getenv("MEDIA_DIR", "/data/media") os.makedirs(MEDIA_DIR, exist_ok=True) app.mount("/media", StaticFiles(directory=MEDIA_DIR), name="media") -APP_VER = "735" # muss mit APP_VER in app.js übereinstimmen +APP_VER = "736" # muss mit APP_VER in app.js übereinstimmen @app.get("/api/version") async def app_version(): diff --git a/backend/static/index.html b/backend/static/index.html index 8fe4dfe..5038216 100644 --- a/backend/static/index.html +++ b/backend/static/index.html @@ -578,7 +578,7 @@ - + diff --git a/backend/static/js/app.js b/backend/static/js/app.js index 85a44c4..a8b5cf3 100644 --- a/backend/static/js/app.js +++ b/backend/static/js/app.js @@ -3,7 +3,7 @@ Router, State-Management, Navigation, Initialisierung. ============================================================ */ -const APP_VER = '735'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen +const APP_VER = '736'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen const APP_VERSION = '1.4.0'; // ← semantische Version, wird bei make release gesetzt const IS_STAGING = location.hostname === 'staging.banyaro.app'; @@ -978,8 +978,8 @@ const App = (() => { 1. Drücke lange auf das App-Icon am Homescreen
2. Wähle „App entfernen" (nur das Symbol, keine Daten)
3. Öffne banyaro.app in Safari und füge die App erneut hinzu` - : `Falls die App nicht aktualisiert:
- Öffne banyaro.app im Browser und füge sie erneut zum Startbildschirm hinzu.`} + : `Falls die Seite noch die alte Version zeigt:
+ Drücke Cmd+Shift+R (Mac) bzw. Ctrl+Shift+R (Windows/Android Chrome) für einen harten Reload.`} `; @@ -991,18 +991,16 @@ const App = (() => { const btn = banner.querySelector('#upd-btn-reload'); btn.textContent = 'Lädt…'; btn.disabled = true; - // SW-Update anstoßen + sessionStorage.setItem('by_update_reload', APP_VER); try { + // SW aktivieren + alle Caches leeren für sauberen Reload const reg = await navigator.serviceWorker?.getRegistration(); if (reg?.waiting) reg.waiting.postMessage({ type: 'SKIP_WAITING' }); await reg?.update(); + const keys = await caches.keys(); + await Promise.all(keys.map(k => caches.delete(k))); } catch { /* ignorieren */ } - // Kurz warten, dann hard reload - setTimeout(() => { - location.reload(); - }, 800); - // Nach Reload: wenn Version immer noch alt, iOS-Hinweis anzeigen - sessionStorage.setItem('by_update_reload', APP_VER); + setTimeout(() => location.reload(), 600); }); } diff --git a/backend/static/sw.js b/backend/static/sw.js index dbc104c..e929ebd 100644 --- a/backend/static/sw.js +++ b/backend/static/sw.js @@ -3,7 +3,7 @@ Offline-Cache + Push Notifications + Tile-Cache ============================================================ */ -const CACHE_VERSION = 'by-v735'; +const CACHE_VERSION = 'by-v736'; const CACHE_STATIC = `${CACHE_VERSION}-static`; const CACHE_TILES = 'ban-yaro-tiles-v1'; // bleibt über SW-Updates erhalten const CACHE_API = 'ban-yaro-api-v1'; // API-Response-Cache