fix(auth): persist ToS acceptance in Rust/SQLite backend

ToS acceptance was stored in localStorage which gets cleared on app
updates, causing users to re-login frequently. Now stores ToS state
in SQLite (~/.local/share/qbz/legal_settings.db) which survives
updates.

- Add legal_settings.rs with SQLite storage for ToS acceptance
- Update qobuzLegalStore.ts to use Rust invoke commands
- LoginView now loads ToS from Rust before auto-login check
- Migration from localStorage for existing users

Closes #31
This commit is contained in:
vicrodh committed 2026-01-30 14:49:39 -06:00
1 parent fe7816f6c6
commit 3926209b0d
5 files changed
+212 -8

No files matched your search

+5 -1
View File
@@ -3,7 +3,7 @@
import TitleBar from '../TitleBar.svelte';
import { t } from '$lib/i18n';
import { setManualOffline } from '$lib/stores/offlineStore';
import { qobuzTosAccepted } from '$lib/stores/qobuzLegalStore';
import { qobuzTosAccepted, loadTosAcceptance } from '$lib/stores/qobuzLegalStore';
import { get } from 'svelte/store';
interface UserInfo {
@@ -83,6 +83,10 @@
return;
}
// Load ToS acceptance from Rust (persisted, survives app updates)
initStatus = 'Loading preferences...';
await loadTosAcceptance();
// Check for saved credentials and auto-login
initStatus = 'Checking saved credentials...';
const hasSavedCreds = await invoke<boolean>('has_saved_credentials');