From a4da7144d6f08fb5043eae4236e216b8a1b4a445 Mon Sep 17 00:00:00 2001 From: rene Date: Wed, 29 Apr 2026 10:54:56 +0200 Subject: [PATCH] =?UTF-8?q?Feature:=20App-Version=20in=20Einstellungen=20+?= =?UTF-8?q?=20manueller=20Update-Check=20=E2=80=94=20SW=20by-v488,=20APP?= =?UTF-8?q?=5FVER=20465?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/static/js/app.js | 2 +- backend/static/js/pages/settings.js | 41 +++++++++++++++++++++++++++-- backend/static/sw.js | 2 +- 3 files changed, 41 insertions(+), 4 deletions(-) diff --git a/backend/static/js/app.js b/backend/static/js/app.js index 7b28961..48715ab 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 = '464'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen +const APP_VER = '465'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen const App = (() => { diff --git a/backend/static/js/pages/settings.js b/backend/static/js/pages/settings.js index 85846e7..63cede8 100644 --- a/backend/static/js/pages/settings.js +++ b/backend/static/js/pages/settings.js @@ -325,10 +325,23 @@ window.Page_settings = (() => { -
+ +
Ban Yaro · banyaro.app
Deine Daten liegen auf einem eigenen Server in Deutschland. +
+ + v${typeof APP_VER !== 'undefined' ? APP_VER : '—'} + + +
@@ -560,6 +573,30 @@ window.Page_settings = (() => { }); }); + document.getElementById('settings-check-update')?.addEventListener('click', async () => { + const btn = document.getElementById('settings-check-update'); + if (!('serviceWorker' in navigator)) { + UI.toast.info('Service Worker nicht verfügbar.'); + return; + } + if (btn) btn.textContent = 'Prüfe…'; + try { + const reg = await navigator.serviceWorker.getRegistration(); + await reg?.update(); + if (reg?.waiting) { + // Neuer SW wartet — sofort aktivieren + reg.waiting.postMessage({ type: 'SKIP_WAITING' }); + UI.toast.success('Update wird installiert…'); + } else { + UI.toast.success('Ban Yaro ist aktuell (v' + (typeof APP_VER !== 'undefined' ? APP_VER : '—') + ').'); + } + } catch { + UI.toast.error('Update-Prüfung fehlgeschlagen.'); + } finally { + if (btn) btn.innerHTML = UI.icon('arrows-clockwise') + ' Auf Update prüfen'; + } + }); + document.getElementById('settings-logout-btn')?.addEventListener('click', async () => { const ok = await UI.modal.confirm({ title : 'Abmelden?', diff --git a/backend/static/sw.js b/backend/static/sw.js index 32743f0..046ab85 100644 --- a/backend/static/sw.js +++ b/backend/static/sw.js @@ -3,7 +3,7 @@ Offline-Cache + Push Notifications + Tile-Cache ============================================================ */ -const CACHE_VERSION = 'by-v487'; +const CACHE_VERSION = 'by-v488'; const CACHE_STATIC = `${CACHE_VERSION}-static`; const CACHE_TILES = 'ban-yaro-tiles-v1'; // bleibt über SW-Updates erhalten