feat: Settings in Datenbank speichern statt localStorage

- Neue Spalte 'settings' in users-Tabelle (Migration via TryAddColumn)
- SettingsEndpoint: GET/PUT /api/settings
- DatabaseService: GetUserSettings() + UpdateUserSettings()
- Frontend: currentSettings als globaler State in app.js
- settings-page.js: localStorage komplett entfernt, nutzt API
- Settings werden beim App-Start aus DB geladen und angewendet
This commit is contained in:
Meleki committed 2026-03-03 16:47:56 +01:00
1 parent aac10901fa
commit a0752ea492
8 files changed
+102 -43

No files matched your search

+15
View File
@@ -306,6 +306,21 @@ async function apiTelegramDeleteWebhook() {
return resp.json();
}
async function apiGetSettings() {
const resp = await fetch('/api/settings');
if (!resp.ok) return {};
return resp.json();
}
async function apiSaveSettings(settings) {
const resp = await fetch('/api/settings', {
method: 'PUT',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(settings)
});
return resp.json();
}
async function apiBackupDb() {
const resp = await fetch('/api/backup', { method: 'POST', credentials: 'include' });
if (!resp.ok) throw new Error('Backup fehlgeschlagen');