Fix: admin.html als Auto-Download, index.html per Speichern-Dialog (v1.2.4)
Zweiter showSaveFilePicker wurde vom Browser blockiert (kein User-Gesture mehr). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
40
index.html
40
index.html
@@ -1713,7 +1713,7 @@
|
||||
// ============================================================
|
||||
// CONSTANTS & CHAPTER CONFIG
|
||||
// ============================================================
|
||||
const APP_VERSION = '1.2.3';
|
||||
const APP_VERSION = '1.2.4';
|
||||
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`; }
|
||||
@@ -4356,29 +4356,27 @@ async function downloadUpdate(version) {
|
||||
adminHtml = await r2.text();
|
||||
} catch(e) { alert('Download fehlgeschlagen: ' + e.message); return; }
|
||||
|
||||
// admin.html immer als klassischen Download starten (läuft parallel, kein zweiter Dialog nötig)
|
||||
const adminBlob = new Blob([adminHtml], { type: 'text/html' });
|
||||
const adminA = document.createElement('a');
|
||||
adminA.href = URL.createObjectURL(adminBlob);
|
||||
adminA.download = 'admin.html';
|
||||
adminA.click();
|
||||
URL.revokeObjectURL(adminA.href);
|
||||
|
||||
if ('showSaveFilePicker' in window) {
|
||||
try {
|
||||
const fh1 = await window.showSaveFilePicker({
|
||||
const fh = await window.showSaveFilePicker({
|
||||
suggestedName: 'index.html',
|
||||
types: [{ description: 'HTML-Datei', accept: { 'text/html': ['.html'] } }],
|
||||
id: 'bni-update',
|
||||
startIn: 'documents',
|
||||
});
|
||||
const w1 = await fh1.createWritable();
|
||||
await w1.write(html);
|
||||
await w1.close();
|
||||
|
||||
const fh2 = await window.showSaveFilePicker({
|
||||
suggestedName: 'admin.html',
|
||||
types: [{ description: 'HTML-Datei', accept: { 'text/html': ['.html'] } }],
|
||||
id: 'bni-update',
|
||||
startIn: 'documents',
|
||||
});
|
||||
const w2 = await fh2.createWritable();
|
||||
await w2.write(adminHtml);
|
||||
await w2.close();
|
||||
|
||||
if (confirm('Update erfolgreich eingespielt!\n\nSeite jetzt neu laden?')) location.reload();
|
||||
const w = await fh.createWritable();
|
||||
await w.write(html);
|
||||
await w.close();
|
||||
alert('index.html wurde gespeichert.\n\nadmin.html liegt im Download-Ordner – bitte in denselben Ordner verschieben und die alte ersetzen.\n\nDanach Seite neu laden.');
|
||||
location.reload();
|
||||
return;
|
||||
} catch(e) {
|
||||
if (e.name === 'AbortError') return;
|
||||
@@ -4387,15 +4385,13 @@ async function downloadUpdate(version) {
|
||||
}
|
||||
|
||||
// Fallback für Browser ohne File System Access API
|
||||
for (const [name, content] of [['index.html', html], ['admin.html', adminHtml]]) {
|
||||
const blob = new Blob([content], { type: 'text/html' });
|
||||
const blob = new Blob([html], { type: 'text/html' });
|
||||
const a = document.createElement('a');
|
||||
a.href = URL.createObjectURL(blob);
|
||||
a.download = name;
|
||||
a.download = 'index.html';
|
||||
a.click();
|
||||
URL.revokeObjectURL(a.href);
|
||||
}
|
||||
alert('Dateien wurden heruntergeladen.\nBitte index.html und admin.html ersetzen und die Seite neu laden.');
|
||||
alert('index.html und admin.html wurden heruntergeladen.\nBitte beide Dateien in den BNI-Ordner verschieben und die alten ersetzen, dann Seite neu laden.');
|
||||
}
|
||||
|
||||
async function fetchChapterMembersFromGitea() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"version": "1.2.3",
|
||||
"version": "1.2.4",
|
||||
"notes": "Timer-Schalter im Admin-Menü"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user