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:
1 parent
aac10901fa
commit
a0752ea492
8 files changed
+102
-43
No files matched your search
+26
-1
@@ -1,5 +1,28 @@
|
||||
// ── Global User State ──
|
||||
// ── Global State ──
|
||||
var currentUser = null;
|
||||
var currentSettings = null;
|
||||
|
||||
const SETTINGS_DEFAULTS = {
|
||||
pageWidth: 900,
|
||||
toolCallDisplay: 'modifications',
|
||||
chainMetaDisplay: 'sometimes',
|
||||
showDeletedMessages: false
|
||||
};
|
||||
|
||||
function loadSettings() {
|
||||
return Object.assign({}, SETTINGS_DEFAULTS, currentSettings);
|
||||
}
|
||||
|
||||
async function saveSettings(settings) {
|
||||
currentSettings = settings;
|
||||
applySettings();
|
||||
try { await apiSaveSettings(settings); } catch (_) {}
|
||||
}
|
||||
|
||||
function applySettings() {
|
||||
var s = loadSettings();
|
||||
document.documentElement.style.setProperty('--page-width', s.pageWidth + 'px');
|
||||
}
|
||||
|
||||
// ── App Init ──
|
||||
|
||||
@@ -12,6 +35,8 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||
}
|
||||
|
||||
currentUser = user;
|
||||
currentSettings = await apiGetSettings();
|
||||
applySettings();
|
||||
loadClaudeStatus();
|
||||
|
||||
const { page, id } = parseHash();
|
||||
|
||||
Reference in new issue
Block a user