Fix: Update-Button → /force-update (kein _nocache-Loop), force-update fire-and-forget ohne await (SW by-v802)
This commit is contained in:
parent
626148436a
commit
322a9609b3
3 changed files with 10 additions and 15 deletions
|
|
@ -341,7 +341,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 = "801" # muss mit APP_VER in app.js übereinstimmen
|
||||
APP_VER = "802" # muss mit APP_VER in app.js übereinstimmen
|
||||
|
||||
@app.get("/.well-known/assetlinks.json")
|
||||
async def assetlinks():
|
||||
|
|
@ -1624,17 +1624,12 @@ p{color:#94a3b8;font-size:14px}</style></head>
|
|||
<div>⏳ Aktualisiere Ban Yaro…</div>
|
||||
<p id="s">Service Worker wird entfernt…</p>
|
||||
<script>
|
||||
(async()=>{
|
||||
document.getElementById('s').textContent='Caches werden geleert…';
|
||||
try{
|
||||
const regs=await navigator.serviceWorker.getRegistrations();
|
||||
await Promise.all(regs.map(r=>r.unregister()));
|
||||
const keys=await caches.keys();
|
||||
await Promise.all(keys.map(k=>caches.delete(k)));
|
||||
}catch(e){}
|
||||
document.getElementById('s').textContent='Fertig — weiterleiten…';
|
||||
setTimeout(()=>location.replace('/'),800);
|
||||
})();
|
||||
// Fire-and-forget — kein await, Reload nach spätestens 1.5s
|
||||
try{
|
||||
navigator.serviceWorker?.getRegistrations().then(r=>r.forEach(s=>s.unregister())).catch(()=>{});
|
||||
caches.keys().then(k=>k.forEach(c=>caches.delete(c))).catch(()=>{});
|
||||
}catch(e){}
|
||||
setTimeout(()=>location.replace('/'),1500);
|
||||
</script></body></html>"""
|
||||
return HTMLResponse(content=html, headers={"Cache-Control": "no-store"})
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Router, State-Management, Navigation, Initialisierung.
|
||||
============================================================ */
|
||||
|
||||
const APP_VER = '801'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen
|
||||
const APP_VER = '802'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen
|
||||
const APP_VERSION = '1.5.0'; // ← semantische Version, wird bei make release gesetzt
|
||||
const IS_STAGING = location.hostname === 'staging.banyaro.app';
|
||||
// Cache-Bust-Parameter nach Update-Reload sofort entfernen
|
||||
|
|
@ -1045,7 +1045,7 @@ const App = (() => {
|
|||
banner.querySelector('#upd-btn-close').addEventListener('click', () => banner.remove());
|
||||
|
||||
banner.querySelector('#upd-btn-reload').addEventListener('click', () => {
|
||||
location.href = '/?_nocache=' + Date.now();
|
||||
location.href = '/force-update';
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Offline-Cache + Push Notifications + Tile-Cache
|
||||
============================================================ */
|
||||
|
||||
const CACHE_VERSION = 'by-v801';
|
||||
const CACHE_VERSION = 'by-v802';
|
||||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue