diff --git a/backend/main.py b/backend/main.py index 4354f38..8ab8c91 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 = "768" # muss mit APP_VER in app.js übereinstimmen +APP_VER = "769" # 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 087f843..9c3a025 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 3ce454e..68ee474 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 = '768'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen +const APP_VER = '769'; // ← 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'; diff --git a/backend/static/js/pages/settings.js b/backend/static/js/pages/settings.js index 1a3ca99..dbb2589 100644 --- a/backend/static/js/pages/settings.js +++ b/backend/static/js/pages/settings.js @@ -753,27 +753,24 @@ window.Page_settings = (() => { } if (btn) btn.textContent = 'Prüfe…'; try { - // Aktuelle Version vom Server holen (no-cache) - const serverResp = await fetch('/js/app.js', { cache: 'no-store' }); - const serverText = await serverResp.text(); - const match = serverText.match(/APP_VERSION\s*=\s*'([^']+)'/); - const serverVersion = match?.[1] || null; - const localVersion = typeof APP_VERSION !== 'undefined' ? APP_VERSION : '0'; + // Versionsnummer direkt vom API-Endpunkt holen + const r = await fetch('/api/version', { cache: 'no-store' }); + const { version: serverVersion } = await r.json(); + const localVersion = typeof APP_VER !== 'undefined' ? APP_VER : '0'; - // SW update anstoßen const reg = await navigator.serviceWorker.getRegistration(); - await reg?.update(); + reg?.update().catch(() => {}); // kein await — kann hängen if (serverVersion && serverVersion !== localVersion) { - // Neuere Version verfügbar — Seite neu laden if (reg?.waiting) reg.waiting.postMessage({ type: 'SKIP_WAITING' }); - UI.toast.info(`Update auf v${serverVersion} verfügbar — Seite wird neu geladen…`); - setTimeout(() => location.reload(), 1500); + UI.toast.info(`Update auf v${serverVersion} — Seite wird neu geladen…`); + setTimeout(() => location.replace('/'), 1500); } else if (reg?.waiting) { reg.waiting.postMessage({ type: 'SKIP_WAITING' }); UI.toast.success('Update wird installiert…'); + setTimeout(() => location.replace('/'), 1500); } else { - UI.toast.success(`Ban Yaro ist aktuell — v${localVersion}`); + UI.toast.success(`Ban Yaro ist aktuell — Build ${localVersion}`); } } catch { UI.toast.error('Update-Prüfung fehlgeschlagen.'); diff --git a/backend/static/js/worlds.js b/backend/static/js/worlds.js index a3d0162..9a8c0e9 100644 --- a/backend/static/js/worlds.js +++ b/backend/static/js/worlds.js @@ -1096,7 +1096,7 @@ window.Worlds = (() => { ${alertHtml} ${user && dog ? `