From 81f3e3bae7d82f0e0ad72d89ea5a5fdae8804712 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Sun, 5 Jul 2026 00:41:11 -0400 Subject: fix: remove redundant 'quality' on items, fix ranged str on ammo, item admin ui updates --- internal/admin/api_tools.go | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 internal/admin/api_tools.go (limited to 'internal/admin/api_tools.go') diff --git a/internal/admin/api_tools.go b/internal/admin/api_tools.go new file mode 100644 index 0000000..9ed7ec3 --- /dev/null +++ b/internal/admin/api_tools.go @@ -0,0 +1,31 @@ +package admin + +import ( + "net/http" +) + +func (s *AdminServer) handleTools(w http.ResponseWriter, r *http.Request) { + if r.Method != http.MethodGet { + http.Error(w, "method not allowed", http.StatusMethodNotAllowed) + return + } + + items, err := s.itemStore.LoadAll() + if err != nil { + http.Error(w, "failed to load items", http.StatusInternalServerError) + return + } + + seen := map[string]bool{} + var tools []string + for _, def := range items { + if def.Tool != nil && def.Tool.Type != "" { + if !seen[def.Tool.Type] { + seen[def.Tool.Type] = true + tools = append(tools, def.Tool.Type) + } + } + } + + writeJSON(w, tools) +} -- cgit v1.2.3