feat(settings): persist user settings server-side with a /settings page#28
Merged
Conversation
Move durable user preferences (theme, spinner, view layout, notifications + sound, cat-gatekeeper config) from per-browser localStorage to the existing pi-web.sqlite via a new settings KV table and GET/POST /api/settings. The theme is injected into the HTML shell server-side (a meta tag) so the page paints correctly before first paint; localStorage becomes a write-through cache hydrated from the server on load. Adds a dedicated /settings page (Go shell + Vite entry) and removes the appearance/notifications/spinner items from the nav dropdown, replacing the placeholder with a real link. Fixes live theme switching so the page background updates without a refresh, and uses subtle border tokens on the settings page for dark mode.
…ence # Conflicts: # docs/architecture/system-overview.md # internal/server/server.go
Contributor
Author
|
Merge conflicts with Conflicts were in two files, resolved to keep both sides:
Verification: |
Add a global Cmd/Ctrl+, shortcut (the standard preferences shortcut) that navigates to /settings. It works regardless of focus, like a native app, and is installed on every page via setupKeyboardNav.
Turn the Settings placeholder into a real /settings link with a ⌘, hint, move Settings above Version so Version always sits at the bottom, and remove the non-functional Import Session / Active Sessions / Archived Sessions items.
Replace the fixed 8-hour sleep window with an explicit wakeup time (default 23:00–07:00) computed from bedtime→wakeup, and add a one-time snooze at the bedtime warning. Settings persistence for the new wakeup key lands with the settings-page changes.
Add server-backed interface and content fonts (curated keywords, typed custom families, or Local Font Access detection) plus separate UI/content font sizes, all injected into the HTML shell so pages paint correctly before JS runs and applied live on the settings page. Add the Cat Gatekeeper wakeup row + its persistence plumbing, and make the settings back button return to the previous in-app page (e.g. a session detail) instead of always going home.
…routes Add a getPostHandler helper that routes GET/POST to their handlers and returns 405 (with an Allow header) for any other method before the auth middleware runs. Apply it to /api/projects, /api/scratchpad, and /api/settings.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
settingsKV table inpi-web.sqliteplusGET/POST /api/settings, moving durable preferences (theme, spinner style, view layout, notify-on-done + sound, cat-gatekeeper config) off per-browserlocalStorage. Unknown keys are ignored; with no DB, reads return defaults and writes no-op.<meta name="pi-web-theme">tag (read by the boot scripts) so the page paints the right theme before first paint and it is shared across browsers.localStoragea write-through cache (web/src/shared/settings-store.js): hydrated from the server on load, written through on change. Existing setters (theme, done-notifier, cat-settings, index layout) route through it./settingspage (Go shell + Vite entry) and strip the appearance/notifications/spinner items from the nav dropdown, replacing the placeholder with a real link.applyThemenow updates the inline<html>background (andtheme-color) so the page background changes without a refresh; settings page uses subtle--dimborders for dark mode.Testing
make check(vitest +go test ./...+go build+go vet)npx vitest run(49 files, 297 tests passing)GET/POST /api/settingsround-trips and the persisted theme is injected into/,/session, and/settings.