aboutsummaryrefslogtreecommitdiff
path: root/internal/admin/api_tools.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-07-05 00:41:11 -0400
committerhistoria <[not public]>2026-07-05 00:41:11 -0400
commit81f3e3bae7d82f0e0ad72d89ea5a5fdae8804712 (patch)
tree55793d006b42778951d9029aa9aeafac7cdfbc6d /internal/admin/api_tools.go
parent4385244d39b37d003dbb7a66a2ff3b05079b7047 (diff)
downloadthehouseoficarus-81f3e3bae7d82f0e0ad72d89ea5a5fdae8804712.tar.gz
fix: remove redundant 'quality' on items, fix ranged str on ammo, item admin ui updates
Diffstat (limited to 'internal/admin/api_tools.go')
-rw-r--r--internal/admin/api_tools.go31
1 files changed, 31 insertions, 0 deletions
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)
+}