Upload via GUI (72 Dateien)
This commit is contained in:
@@ -67,9 +67,33 @@ function paintBanners() {
|
||||
box.append(h('div', { class: 'banner error' }, h('span', { class: 'grow' }, `Keine Verbindung zum Server – nächster Versuch in ${state.retryIn || 10} s. Bereits geladene Daten sind eventuell veraltet.`),
|
||||
h('button', { class: 'btn ghost sm', onclick: retryNow }, 'Jetzt erneut versuchen')));
|
||||
}
|
||||
const u = state.update;
|
||||
if (u?.available) {
|
||||
box.append(h('div', { class: 'banner warn' },
|
||||
h('span', { class: 'grow' }, u.busy ? `Update ${u.version} wird geladen … ${u.pct || 0} %` : `Update verfügbar: DeskHub ${u.version} (installiert: ${u.current}).${u.notes ? ' ' + u.notes : ''}`),
|
||||
u.busy ? null : h('button', { class: 'btn sm', onclick: installUpdate }, 'Jetzt aktualisieren'),
|
||||
u.busy ? null : h('button', { class: 'btn ghost sm', onclick: () => { state.update = { ...u, dismissed: u.version, available: false }; paintBanners(); } }, 'Später')));
|
||||
}
|
||||
for (const i of state.health || []) box.append(h('div', { class: 'banner ' + (i.level === 'error' ? 'error' : 'warn') }, h('span', { class: 'grow' }, (i.level === 'error' ? 'Störung: ' : 'Hinweis: ') + i.message)));
|
||||
}
|
||||
const post = (path, body) => api(path, { method: 'POST', body });
|
||||
|
||||
// ─── Programm-Update: beim Start und danach alle 6 Stunden prüfen, Banner mit Button ───────────────────────
|
||||
async function checkUpdate() {
|
||||
try {
|
||||
const r = await window.deskhub.updateCheck();
|
||||
if (r.error || !r.data?.packaged || state.update?.busy) return;
|
||||
const d = r.data;
|
||||
state.update = { ...d, available: d.available && state.update?.dismissed !== d.version, dismissed: state.update?.dismissed };
|
||||
paintBanners();
|
||||
} catch { /* Update-Prüfung ist optional */ }
|
||||
}
|
||||
async function installUpdate() {
|
||||
state.update = { ...state.update, busy: true, pct: 0 }; paintBanners();
|
||||
const r = await window.deskhub.updateInstall();
|
||||
if (r.error) { state.update = { ...state.update, busy: false }; paintBanners(); toast(r.error.message, true); }
|
||||
}
|
||||
window.deskhub.onUpdateProgress((pct) => { if (state.update?.busy) { state.update.pct = pct; paintBanners(); } });
|
||||
async function run(fn, okMsg) {
|
||||
try { const r = await fn(); if (okMsg) toast(okMsg); return r; }
|
||||
catch (e) { toast(e.message, true); return undefined; }
|
||||
@@ -145,6 +169,7 @@ const initials = (name) => (name || '?').split(/\s+/).filter(Boolean).slice(0, 2
|
||||
const metaKey = (url) => 'meta:' + url;
|
||||
async function startApp(staff, cachedMeta, serverUrl) {
|
||||
state.staff = staff;
|
||||
checkUpdate(); clearInterval(state.updateTimer); state.updateTimer = setInterval(checkUpdate, 6 * 3600 * 1000);
|
||||
state.since = ''; state.badge = 0;
|
||||
if (!state.prefs) state.prefs = await window.deskhub.settings();
|
||||
applyTheme();
|
||||
|
||||
Reference in New Issue
Block a user