Add audited admin player item and title management

This commit is contained in:
dingo
2026-09-08 07:20:18 -04:00
parent ed55cd23ab
commit ece92fa65c
15 changed files with 512 additions and 8 deletions
+11
View File
@@ -1,6 +1,7 @@
package transport
import (
"aeternalis/server/internal/game"
"context"
"errors"
"net/http"
@@ -100,6 +101,16 @@ func (h *HTTP) portalRoutes(mux *http.ServeMux) {
return
}
switch req.Op {
case "grant-item", "remove-item":
if _, _, err := game.ParseItemChange(req.Value); err != nil {
fail(w, 400, err.Error())
return
}
case "grant-title", "revoke-title":
if !regexp.MustCompile(`^[a-z][a-z0-9_-]{0,63}$`).MatchString(req.Value) {
fail(w, 400, "choose a title")
return
}
case "create-world":
if h.Provisioner == nil {
fail(w, 503, "GitOps provisioning is not configured")
+4 -2
View File
@@ -216,8 +216,10 @@ func (s *Service) controls(ctx context.Context) error {
if !found {
result = "account not found in world"
}
} else if err = s.world.Control(command.Op, command.Target, command.Value, command.Reason); err != nil {
result = err.Error()
} else if !game.IsContentCommand(command.Op) {
if err = s.world.Control(command.Op, command.Target, command.Value, command.Reason); err != nil {
result = err.Error()
}
}
if err = s.lease.SaveCommand(ctx, s.world, "", &command, result); err != nil {
s.ready.Store(false)