From 84dd8c7557d8b9d92cd8d339afc28a0fd9a3a896 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Wed, 15 Jul 2026 05:10:40 -0400 Subject: feat(admin): color scheme test page added --- internal/admin/server.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'internal/admin/server.go') diff --git a/internal/admin/server.go b/internal/admin/server.go index 9983a0b..842f640 100644 --- a/internal/admin/server.go +++ b/internal/admin/server.go @@ -55,9 +55,12 @@ type AdminServer struct { // admin web GUI can trigger the same migration as the swapid command // without the admin package depending on game. rewriteRoomIDs func(idMap map[int]int) + // configPath is the on-disk config.yaml path, used by the color themer + // to persist edited default_colors back to the file the game loaded. + configPath string } -func NewServer(cfg *config.Config, useTLS bool, accountStore *player.AccountStore, w *world.World, is *item.ItemStore, os *object.ObjectStore, ms *world.MobStore, dataDir string, reloadCourses func(), rewriteRoomIDs func(map[int]int)) (*AdminServer, error) { +func NewServer(cfg *config.Config, useTLS bool, accountStore *player.AccountStore, w *world.World, is *item.ItemStore, os *object.ObjectStore, ms *world.MobStore, dataDir string, reloadCourses func(), rewriteRoomIDs func(map[int]int), configPath string) (*AdminServer, error) { secret := make([]byte, 32) if _, err := rand.Read(secret); err != nil { return nil, fmt.Errorf("cookie secret: %w", err) @@ -102,6 +105,7 @@ func NewServer(cfg *config.Config, useTLS bool, accountStore *player.AccountStor cookieSecret: secret, reloadCourses: reloadCourses, rewriteRoomIDs: rewriteRoomIDs, + configPath: configPath, } mux := http.NewServeMux() @@ -185,6 +189,8 @@ func NewServer(cfg *config.Config, useTLS bool, accountStore *player.AccountStor apiMux.HandleFunc("/api/rooms/resolve-duplicate", s.handleResolveDuplicate) apiMux.HandleFunc("/api/triggers", s.handleTriggers) apiMux.HandleFunc("/api/triggers/", s.handleTriggerByID) + apiMux.HandleFunc("/api/colors", s.handleColors) + apiMux.HandleFunc("/api/colors/reset", s.handleColorsReset) mux.Handle("/api/", s.authMiddleware(apiMux)) -- cgit v1.2.3