Feature: App-Version in Einstellungen + manueller Update-Check — SW by-v488, APP_VER 465
This commit is contained in:
parent
e507f4c086
commit
a4da7144d6
3 changed files with 41 additions and 4 deletions
|
|
@ -325,10 +325,23 @@ window.Page_settings = (() => {
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div style="text-align:center;color:var(--c-text-secondary);
|
||||
font-size:var(--text-xs)">
|
||||
<!-- App-Version & Update -->
|
||||
<div style="text-align:center;color:var(--c-text-secondary);font-size:var(--text-xs)">
|
||||
Ban Yaro · banyaro.app<br>
|
||||
Deine Daten liegen auf einem eigenen Server in Deutschland.
|
||||
<div style="margin-top:var(--space-3);display:flex;align-items:center;
|
||||
justify-content:center;gap:var(--space-2);flex-wrap:wrap">
|
||||
<span style="background:var(--c-surface-2);border:1px solid var(--c-border);
|
||||
border-radius:100px;padding:2px 10px;font-family:monospace;
|
||||
font-size:10px;color:var(--c-text-muted)">
|
||||
v${typeof APP_VER !== 'undefined' ? APP_VER : '—'}
|
||||
</span>
|
||||
<button id="settings-check-update" style="background:none;border:none;cursor:pointer;
|
||||
font-size:var(--text-xs);color:var(--c-primary);padding:2px 6px;
|
||||
border-radius:var(--radius-sm)">
|
||||
${UI.icon('arrows-clockwise')} Auf Update prüfen
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
@ -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?',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue