diff options
| author | historia <[not public]> | 2026-09-16 15:00:46 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-09-16 15:00:46 -0400 |
| commit | a6cf03a6ae98e4fb675da25046d148e92bcf7206 (patch) | |
| tree | 194499fe9e696be8c31cd915b7ad92678f9f95e0 /internal/admin/api_colors.go | |
| parent | 9192d94dea6be5498ab080f3e2df5667af871d7a (diff) | |
| download | thehouseoficarus-a6cf03a6ae98e4fb675da25046d148e92bcf7206.tar.gz | |
chore: staticcheck and gofmt cleanups
Diffstat (limited to 'internal/admin/api_colors.go')
| -rw-r--r-- | internal/admin/api_colors.go | 34 |
1 files changed, 8 insertions, 26 deletions
diff --git a/internal/admin/api_colors.go b/internal/admin/api_colors.go index 876656d..b57ad82 100644 --- a/internal/admin/api_colors.go +++ b/internal/admin/api_colors.go @@ -3,7 +3,6 @@ package admin import ( "net/http" "os" - "sort" "strings" "gopkg.in/yaml.v3" @@ -185,11 +184,6 @@ func knownConstantColor(name string) bool { return false } -// knownColor returns true if name is editable in either section. -func knownColor(name string) bool { - return knownPlayerColor(name) || knownConstantColor(name) -} - // seg is a small constructor helper for the inline preview builder. func seg(t, cat string) colorSegment { return colorSegment{T: t, C: cat} @@ -280,7 +274,6 @@ func buildPreview() []colorSection { ln(seg("Oh dear, you are dead!", "death")), txt(""), txt(""), - }, }) @@ -479,20 +472,20 @@ func (s *AdminServer) getColors(w http.ResponseWriter, _ *http.Request) { } writeJSON(w, map[string]any{ - "colors": live, - "default_colors": def, - "categories": colorCategories, - "constant_colors": liveConst, + "colors": live, + "default_colors": def, + "categories": colorCategories, + "constant_colors": liveConst, "default_constant_colors": defConst, - "constant_categories": constantCategories, - "preview": buildPreview(), + "constant_categories": constantCategories, + "preview": buildPreview(), }) } func (s *AdminServer) saveColors(w http.ResponseWriter, r *http.Request) { var body struct { - Colors map[string]string `json:"colors"` - ConstantColors map[string]string `json:"constant_colors"` + Colors map[string]string `json:"colors"` + ConstantColors map[string]string `json:"constant_colors"` } if err := readJSON(r, &body); err != nil { writeJSONError(w, "invalid request body", http.StatusBadRequest) @@ -593,14 +586,3 @@ func (s *AdminServer) writeConfigFile() error { } return os.WriteFile(s.configPath, out, 0644) } - -// sortedKeys is a small helper retained in case future code wants a stable -// iteration order over the category names. -func sortedKeys(m map[string]string) []string { - keys := make([]string, 0, len(m)) - for k := range m { - keys = append(keys, k) - } - sort.Strings(keys) - return keys -} |
