feat(webui): bootstrap account settings management with light and dark mode

This commit is contained in:
Julien Dessaux 2025-01-30 00:19:16 +01:00
parent ab043d8617
commit 98c7d6f578
Signed by: adyxax
GPG key ID: F92E51B86E07177E
13 changed files with 136 additions and 14 deletions

View file

@ -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))
}))
}