diff --git a/index.html b/index.html index 4a2ced1..1842006 100644 --- a/index.html +++ b/index.html @@ -1713,7 +1713,7 @@ // ============================================================ // CONSTANTS & CHAPTER CONFIG // ============================================================ -const APP_VERSION = '1.1.2'; +const APP_VERSION = '1.2.0'; const GITEA_RAW = 'http://72.60.134.73:3000/api/v1/repos/cheubaum/BNI-Vorstellungsrunde/raw'; const GITEA_API = 'http://72.60.134.73:3000/api/v1/repos/cheubaum/BNI-Vorstellungsrunde'; function giteaUrl(path) { return `${GITEA_RAW}/${path}?ref=main`; } @@ -4345,16 +4345,40 @@ async function downloadUpdate(version) { return; } } catch(e) { alert('Keine Serververbindung möglich.'); return; } + + let html; try { const res = await fetch(giteaUrl('index.html'), { cache: 'no-store' }); - const html = await res.text(); - const blob = new Blob([html], { type: 'text/html' }); - const a = document.createElement('a'); - a.href = URL.createObjectURL(blob); - a.download = 'index.html'; - a.click(); - URL.revokeObjectURL(a.href); - } catch(e) { alert('Download fehlgeschlagen: ' + e.message); } + html = await res.text(); + } catch(e) { alert('Download fehlgeschlagen: ' + e.message); return; } + + if ('showOpenFilePicker' in window) { + try { + const [fileHandle] = await window.showOpenFilePicker({ + types: [{ description: 'HTML-Datei', accept: { 'text/html': ['.html'] } }], + multiple: false, + id: 'bni-update', + startIn: 'documents', + }); + const writable = await fileHandle.createWritable(); + await writable.write(html); + await writable.close(); + if (confirm('Update erfolgreich eingespielt!\n\nSeite jetzt neu laden?')) location.reload(); + return; + } catch(e) { + if (e.name === 'AbortError') return; + // Fall through to classic download + } + } + + // Fallback für Browser ohne File System Access API + const blob = new Blob([html], { type: 'text/html' }); + const a = document.createElement('a'); + a.href = URL.createObjectURL(blob); + a.download = 'index.html'; + a.click(); + URL.revokeObjectURL(a.href); + alert('Datei wurde heruntergeladen.\nBitte die alte index.html damit ersetzen und die Seite neu laden.'); } async function fetchChapterMembersFromGitea() { diff --git a/version.json b/version.json index 58c48e0..212e600 100644 --- a/version.json +++ b/version.json @@ -1,4 +1,4 @@ { - "version": "1.1.2", - "notes": "Timer-Schalter im Admin-Menü, DigiSeed-Logo Fix" + "version": "1.2.0", + "notes": "Timer-Schalter im Admin-Menü" }