From 1c6ec6f17e14e58e78c906b55bf95e9ba4a90f20 Mon Sep 17 00:00:00 2001 From: rene Date: Tue, 14 Apr 2026 17:33:12 +0200 Subject: [PATCH] Fix: /update-Endpunkt zum manuellen SW-Cache-Reset + STATIC_ASSETS bereinigt /update loescht SW + alle Caches via JS und leitet zur App zurueck. Alter SW hat /update nie gecacht -> immer frisch vom Server. STATIC_ASSETS ohne ?v= (verhindert fehlerhafte cache.addAll()-Fehler). --- backend/main.py | 43 +++++++++++++++++++++++++++++++++++++++++++ backend/static/sw.js | 10 +++++----- 2 files changed, 48 insertions(+), 5 deletions(-) diff --git a/backend/main.py b/backend/main.py index 13b6b3a..72e0c35 100644 --- a/backend/main.py +++ b/backend/main.py @@ -129,6 +129,49 @@ async def share_target(request: Request): headers={"Cache-Control": "no-cache"} ) +# Cache-Reset-Seite — löscht SW + Caches, leitet zur App weiter +@app.get("/update") +async def force_update(): + from fastapi.responses import HTMLResponse + html = """ + + + + + Ban Yaro — Aktualisieren + + + +
+

Ban Yaro

+

App wird aktualisiert…

+
+
+ + +""" + return HTMLResponse(html, headers={"Cache-Control": "no-store"}) + + # SPA Fallback — ALLE nicht-API-Routen gehen zur index.html @app.get("/{full_path:path}") async def spa_fallback(full_path: str): diff --git a/backend/static/sw.js b/backend/static/sw.js index faf7df6..c05aeaf 100644 --- a/backend/static/sw.js +++ b/backend/static/sw.js @@ -9,11 +9,11 @@ const CACHE_STATIC = `${CACHE_VERSION}-static`; // index.html wird NICHT pre-gecacht (immer Network-First) const STATIC_ASSETS = [ '/css/design-system.css', - '/css/layout.css?v=32', - '/css/components.css?v=32', - '/js/api.js?v=32', - '/js/ui.js?v=32', - '/js/app.js?v=32', + '/css/layout.css', + '/css/components.css', + '/js/api.js', + '/js/ui.js', + '/js/app.js', '/manifest.json', '/icons/icon-192.png', ];