Add theme color editor and multi-step undo
- New /edit/theme-settings page with native color pickers for the background/primary/positive/negative theme colors plus light mode, contrast and saturation multipliers, custom-css-file path, and picker-disable. Pickers use hex; the backend converts to Glance's HSL "H S L" form before writing. Theme presets and full custom CSS intentionally still YAML. - Numbered backup chain: save() rotates up to 10 prior versions as glance.yml.bak.1 .. .10 instead of a single .bak. The /edit page lists them with humanized timestamps and a per-row Restore button. Single-step "Restore previous (toggle)" is preserved. - Restoring any backup saves the just-current state as a fresh .bak.1, so undo-the-undo always works. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
e108feb74b
commit
7a0a4b9780
@@ -456,6 +456,7 @@ func (a *application) server() (func() error, func() error) {
|
||||
mux.HandleFunc("GET /edit/pages/{page}", a.handleAdminPage)
|
||||
mux.HandleFunc("GET /edit/pages/{page}/settings", a.handleAdminPageSettings)
|
||||
mux.HandleFunc("GET /edit/site-settings", a.handleAdminSiteSettings)
|
||||
mux.HandleFunc("GET /edit/theme-settings", a.handleAdminThemeSettings)
|
||||
mux.HandleFunc("GET /edit/pages/{page}/widgets/{col}/{idx}", a.handleAdminWidget)
|
||||
|
||||
mux.HandleFunc("POST /edit/api/pages", a.handleAdminAddPage)
|
||||
@@ -479,7 +480,9 @@ func (a *application) server() (func() error, func() error) {
|
||||
mux.HandleFunc("POST /edit/api/pages/{page}/fields", a.handleAdminUpdatePageFields)
|
||||
mux.HandleFunc("POST /edit/api/pages/{page}/move", a.handleAdminMovePage)
|
||||
mux.HandleFunc("POST /edit/api/restore", a.handleAdminRestore)
|
||||
mux.HandleFunc("POST /edit/api/restore/{n}", a.handleAdminRestoreFromBackup)
|
||||
mux.HandleFunc("POST /edit/api/site-settings", a.handleAdminUpdateSiteSettings)
|
||||
mux.HandleFunc("POST /edit/api/theme-settings", a.handleAdminUpdateTheme)
|
||||
|
||||
if a.RequiresAuth {
|
||||
mux.HandleFunc("GET /login", a.handleLoginPageRequest)
|
||||
|
||||
Reference in New Issue
Block a user