diff options
| author | historia <[not public]> | 2026-09-15 13:56:10 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-09-15 13:56:48 -0400 |
| commit | b3568f03e4103dd46db2ccc680fbab0a6454d604 (patch) | |
| tree | db3f6bb4f3d7c1deefbcd50de0f5022756d6b9ae /internal/admin/api_items.go | |
| parent | f4ea40c4b3589104dfaced3481ba19c5735889ae (diff) | |
| download | thehouseoficarus-b3568f03e4103dd46db2ccc680fbab0a6454d604.tar.gz | |
fix: telnet buffer reuse, bank stack handling,
transport casino gate, and admin cache invalidation
Diffstat (limited to 'internal/admin/api_items.go')
| -rw-r--r-- | internal/admin/api_items.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/internal/admin/api_items.go b/internal/admin/api_items.go index 617908c..728997a 100644 --- a/internal/admin/api_items.go +++ b/internal/admin/api_items.go @@ -46,6 +46,14 @@ func (s *AdminServer) handleItemByID(w http.ResponseWriter, r *http.Request) { } } +// invalidateItemCache drops the in-game item cache after an editor write so +// gameplay picks up the change without a manual reload, and rebuilds the +// craft index. Also refreshes the path index in case the file was created +// or removed. +func (s *AdminServer) invalidateItemCache() { + s.invalidateEntityCaches("items") +} + func (s *AdminServer) findItemFile(id string) ([]byte, string, error) { data, path, err := readYAMLFile(s.dataDir, "items", id) if err == nil { @@ -103,6 +111,7 @@ func (s *AdminServer) updateItem(w http.ResponseWriter, r *http.Request, id stri OldContent: oldContent, NewContent: newContent, }) + s.invalidateItemCache() writeJSON(w, m) } @@ -127,6 +136,7 @@ func (s *AdminServer) deleteItem(w http.ResponseWriter, r *http.Request, id stri OldContent: oldContent, IsDelete: true, }) + s.invalidateItemCache() writeJSON(w, map[string]any{"deleted": id}) } @@ -162,6 +172,7 @@ func (s *AdminServer) createItem(w http.ResponseWriter, r *http.Request) { NewContent: newContent, IsCreate: true, }) + s.invalidateItemCache() writeJSON(w, m) } |
