From 98c7d6f5785182117b9fe6ebd6b892f860bc2024 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Thu, 30 Jan 2025 00:19:16 +0100 Subject: feat(webui): bootstrap account settings management with light and dark mode --- pkg/webui/login.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'pkg/webui/login.go') diff --git a/pkg/webui/login.go b/pkg/webui/login.go index 6f688c1..18864b2 100644 --- a/pkg/webui/login.go +++ b/pkg/webui/login.go @@ -2,8 +2,10 @@ package webui import ( "context" + "encoding/json" "fmt" "html/template" + "log/slog" "net/http" "regexp" @@ -113,6 +115,11 @@ func loginMiddleware(db *database.DB, requireSession func(http.Handler) http.Han return } ctx := context.WithValue(r.Context(), model.AccountContextKey{}, account) + var settings model.Settings + if err := json.Unmarshal(account.Settings, &settings); err != nil { + slog.Error("failed to unmarshal account settings", "err", err, "accountId", account.Id) + } + ctx = context.WithValue(ctx, model.SettingsContextKey{}, &settings) next.ServeHTTP(w, r.WithContext(ctx)) })) } -- cgit v1.2.3