settings export/import/reset + interaktive tutorial-tour

Settings (Einstellungen → Allgemein → Daten):
- Exportieren (JSON-Download), Importieren (Datei zurückladen),
  "Zurücksetzen & als neuer User starten" – sichert settings.json
  vorher automatisch (timestamped), dann Ersteinrichtung.
- Server: GET /api/settings/export, POST /api/settings/import,
  POST /api/settings/reset; lib/settings.js: exportData/importData/reset.

Interaktive Tour (Hilfe-Dialog → "Diesen Bereich zeigen"):
- Spotlight wandert animiert über die echten UI-Elemente, Sprechblase
  mit Text, Auto-Play + Pause/Zurück/Weiter/Schließen, Pfeiltasten/Esc.
- Pro Bereich (Ansichten, Finden, Projekt, Backup, Gut zu wissen) eigene
  Schritte; wechselt bei Bedarf Ansicht/Modus bzw. öffnet ein Projekt und
  stellt danach den Ausgangszustand wieder her. Fehlende Ziele werden
  übersprungen. Zweisprachig.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-11-24 20:40:33 +01:00
parent 53f9a51486
commit a42fa5adb1
5 changed files with 297 additions and 8 deletions

View File

@@ -452,6 +452,32 @@ app.post('/api/settings', (req, res) => {
res.status(400).json({ error: String(e.message ?? e) })
}
})
// Export the settings as JSON (client offers it as a download).
app.get('/api/settings/export', (req, res) => {
res.json(settings.exportData())
})
// Import a settings object (from a previously exported file) and apply it.
app.post('/api/settings/import', (req, res) => {
if (storage.busy() || backup.busy() || create.busy()) return res.status(409).json({ error: 'Erst warten, bis Scan/Backup fertig ist.' })
try {
settings.importData(req.body?.data ?? req.body)
applySettings()
res.json({ ...settings.get(), configured: !!ROOT_DIR, dataDir: settings.DATA_DIR })
} catch (e) {
res.status(400).json({ error: String(e.message ?? e) })
}
})
// Reset to a fresh "new user" state. Backs up settings.json first, then starts over.
app.post('/api/settings/reset', (req, res) => {
if (storage.busy() || backup.busy() || create.busy() || archive.busy()) return res.status(409).json({ error: 'Erst warten, bis Scan/Backup fertig ist.' })
try {
const r = settings.reset()
applySettings()
res.json({ ok: true, backupFile: r.backupFile })
} catch (e) {
res.status(400).json({ error: String(e.message ?? e) })
}
})
// Update detection: newest change of the server code (server.js, lib\*.js) and
// of the page (public\*). The server code is only read at start, so a newer
// file means "restart needed"; the page only needs a reload.