Release v0.2.34

This commit is contained in:
ponzischeme89
2026-08-09 08:25:50 +12:00
parent b1128bcce2
commit fdd9e6cab2
116 changed files with 11418 additions and 879 deletions
+19
View File
@@ -44,6 +44,11 @@ type adminMembyAccount struct {
// the defaults, and saying so is the difference between "chose this" and "has not
// chosen anything".
Settings adminAccountSettings `json:"settings"`
// Themes is the ids this person may choose between, and an empty array means every
// selectable theme rather than none — the same permissive reading the store and
// themeAllowed take. The console renders that as every box ticked, which is what an
// operator who has never touched the page should see.
Themes []string `json:"themes"`
}
type adminAccountSettings struct {
@@ -87,6 +92,14 @@ func (s *Server) handleAdminAccounts(w http.ResponseWriter, r *http.Request) {
settings = map[string]store.UserPreferences{}
}
themes, err := s.store.AllUserThemes(r.Context())
if err != nil {
// Same trade the settings read above makes: a colour allowlist that would not load
// must not cost the operator the device list and the sign-out buttons.
s.loggerFor(r.Context()).Warn("theme allowlist read failed", "error", err)
themes = map[string][]string{}
}
result := make([]adminMembyAccount, 0, len(accounts))
for _, account := range accounts {
pref := preferences[account.ID]
@@ -115,6 +128,7 @@ func (s *Server) handleAdminAccounts(w http.ResponseWriter, r *http.Request) {
result = append(result, adminMembyAccount{
ID: account.ID, Username: account.Username, CreatedAt: account.CreatedAt,
LastSeen: account.LastSeen, Devices: account.Devices, Settings: accountSettings,
Themes: nonNilStrings(themes[account.ID]),
Recommendations: adminOnboardingPreferences{
Completed: pref.Completed, Prompted: pref.Prompted,
Updated: len(account.RecommendationPreferences) > 2,
@@ -131,6 +145,11 @@ func (s *Server) handleAdminAccounts(w http.ResponseWriter, r *http.Request) {
writeJSON(w, http.StatusOK, map[string]any{
"accounts": result, "catalogue": preferenceCatalogue,
"schemaVersion": preferenceSchemaVersion,
// The selectable themes, for the same reason the preference catalogue rides along:
// a page that hard-coded the swatches would drift from what the gateway will accept
// the first time a theme is added, and would do it without saying so. Seasonal ones
// are absent because they are not grantable — see themes.go.
"themes": selectableThemes(),
})
}