From c8ef4939f1a80bfe36ac542b645c697503a4def3 Mon Sep 17 00:00:00 2001 From: rene Date: Wed, 27 May 2026 08:02:54 +0200 Subject: [PATCH] =?UTF-8?q?Fix:=20/force-update=20reload-H=C3=A4nger=20+?= =?UTF-8?q?=20Cooldown=20persistent,=20SW=20by-v1106?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit User-Report: 'Leckerlis'-Screen verschwindet nicht mehr. Bug: Vorige Version nutzte 'await Promise.all([sw-unregister, caches.delete])' VOR dem Reload. Auf iOS-PWA können diese Promises gelegentlich nie resolven → Reload kommt nie. Fix /force-update: - Cleanup-Tasks fire-and-forget (kein await, kein Promise.all) - Sofort-Reload nach 150ms (kein await-Block) - Fallback 1: Nach 3s erscheint 'App neu starten'-Button für manuellen Tap - Fallback 2: Nach 6s automatisch location.href mit ?hard=1 Fix app.js Cooldown: - localStorage statt sessionStorage — überlebt PWA-App-Close - 10 Min statt 5 Min Cooldown (großzügiger Spielraum bei Update-Wellen) --- VERSION | 2 +- backend/main.py | 50 +++++++++++++++++++++---------------- backend/static/index.html | 24 +++++++++--------- backend/static/js/app.js | 14 ++++++----- backend/static/landing.html | 2 +- backend/static/sw.js | 2 +- 6 files changed, 52 insertions(+), 42 deletions(-) diff --git a/VERSION b/VERSION index 2b48a28..5642d7e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1105 \ No newline at end of file +1106 \ No newline at end of file diff --git a/backend/main.py b/backend/main.py index b409706..aac642e 100644 --- a/backend/main.py +++ b/backend/main.py @@ -1763,32 +1763,40 @@ async def force_update(): Ban Yaro — Update +p{color:#94a3b8;font-size:14px} +button{margin-top:24px;background:#C4843A;color:#fff;border:none;padding:12px 24px; +border-radius:8px;font-size:16px;cursor:pointer}
⏳ Einen Moment…

Wir besorgen neue Leckerlis 🦴

+ """ return HTMLResponse(content=html, headers={"Cache-Control": "no-store"}) diff --git a/backend/static/index.html b/backend/static/index.html index 0efb61d..113e542 100644 --- a/backend/static/index.html +++ b/backend/static/index.html @@ -86,14 +86,14 @@ Ban Yaro - + - - - - - + + + + + @@ -617,11 +617,11 @@ - - - - - + + + + + @@ -631,7 +631,7 @@ - + diff --git a/backend/static/js/app.js b/backend/static/js/app.js index fa2432e..08770c9 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 = '1105'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen +const APP_VER = '1106'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen const APP_VERSION = '1.6.0'; // ← semantische Version, wird bei make release gesetzt window.APP_VER = APP_VER; // global verfügbar für andere Module (z.B. offline-indicator) window.APP_VERSION = APP_VERSION; @@ -129,17 +129,19 @@ const App = (() => { function navigate(pageId, pushHistory = true, params = {}) { if (!pages[pageId]) return; // Neue Version erkannt → nur aktualisieren wenn kein Bearbeitungsfenster offen ist - // UND wenn nicht erst kürzlich force-update lief (Cooldown 5 Min) — verhindert Loop - // bei mehreren schnellen Deploys oder iOS-PWA-Cache-Quirks. + // UND wenn nicht erst kürzlich force-update lief (Cooldown 10 Min) — verhindert Loop + // bei mehreren schnellen Deploys oder iOS-PWA-Cache-Quirks. localStorage überlebt + // App-Restarts (sessionStorage wäre bei PWA-Standalone-close weg). if (window._byUpdatePending) { const modalOpen = document.querySelector('#modal-container .modal-overlay') !== null; - const lastForce = parseInt(sessionStorage.getItem('by_last_force_update') || '0', 10); - const cooldownActive = (Date.now() - lastForce) < 5 * 60 * 1000; + let lastForce = 0; + try { lastForce = parseInt(localStorage.getItem('by_last_force_update') || '0', 10); } catch {} + const cooldownActive = (Date.now() - lastForce) < 10 * 60 * 1000; if (!modalOpen && !cooldownActive) { window._byUpdatePending = false; sessionStorage.setItem('by_updated_to', window._byNewVersion || ''); sessionStorage.setItem('by_update_target', pageId); - sessionStorage.setItem('by_last_force_update', String(Date.now())); + try { localStorage.setItem('by_last_force_update', String(Date.now())); } catch {} location.href = '/force-update'; return; } diff --git a/backend/static/landing.html b/backend/static/landing.html index 8616190..f5e3ad8 100644 --- a/backend/static/landing.html +++ b/backend/static/landing.html @@ -4,7 +4,7 @@ - + Ban Yaro — Die Hunde-App für Deutschland, Österreich & Schweiz diff --git a/backend/static/sw.js b/backend/static/sw.js index 0bbb83e..d0ef7bf 100644 --- a/backend/static/sw.js +++ b/backend/static/sw.js @@ -4,7 +4,7 @@ ============================================================ */ // ← EINZIGE Stelle für die Version — STATIC_ASSETS und CACHE_VERSION leiten sich ab -const VER = '1105'; +const VER = '1106'; const CACHE_VERSION = `by-v${VER}`; const CACHE_STATIC = `${CACHE_VERSION}-static`; const CACHE_TILES = 'ban-yaro-tiles-v1'; // bleibt über SW-Updates erhalten