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"})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue