From e7848ea79a9a57fdf391d30c48ce649f3d2f6180 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Fri, 18 Sep 2026 21:44:49 -0400 Subject: refactor: dedup admin entity handlers and server construction --- cmd/thoi/main.go | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) (limited to 'cmd') diff --git a/cmd/thoi/main.go b/cmd/thoi/main.go index cf31177..915d7ca 100644 --- a/cmd/thoi/main.go +++ b/cmd/thoi/main.go @@ -80,7 +80,22 @@ func main() { // Both admin transports share one UndoStack over the shared history file. var sharedUndo *admin.UndoStack if cfg.AdminHTTP.Enabled { - adminSrv, err := admin.NewServer(cfg, false, g.AccountStore, g.World, g.ItemStore, g.ObjectStore, g.MobStore, dataDir, adminReloadCourses, adminRewriteRoomIDs, adminEvictRoom, adminRebuildCraftIndex, *configPath, g.RunAdminOnOwner) + adminSrv, err := admin.NewServer(admin.ServerDeps{ + Config: cfg, + UseTLS: false, + Accounts: g.AccountStore, + World: g.World, + Items: g.ItemStore, + Objects: g.ObjectStore, + Mobs: g.MobStore, + DataDir: dataDir, + ReloadCourses: adminReloadCourses, + RewriteRoomIDs: adminRewriteRoomIDs, + EvictRoom: adminEvictRoom, + RebuildCraftIndex: adminRebuildCraftIndex, + ConfigPath: *configPath, + RunOnOwner: g.RunAdminOnOwner, + }) if err != nil { log.Fatalf("failed to start admin HTTP server: %v", err) } @@ -97,7 +112,22 @@ func main() { } if cfg.AdminHTTPS.Enabled { - adminSrv, err := admin.NewServer(cfg, true, g.AccountStore, g.World, g.ItemStore, g.ObjectStore, g.MobStore, dataDir, adminReloadCourses, adminRewriteRoomIDs, adminEvictRoom, adminRebuildCraftIndex, *configPath, g.RunAdminOnOwner) + adminSrv, err := admin.NewServer(admin.ServerDeps{ + Config: cfg, + UseTLS: true, + Accounts: g.AccountStore, + World: g.World, + Items: g.ItemStore, + Objects: g.ObjectStore, + Mobs: g.MobStore, + DataDir: dataDir, + ReloadCourses: adminReloadCourses, + RewriteRoomIDs: adminRewriteRoomIDs, + EvictRoom: adminEvictRoom, + RebuildCraftIndex: adminRebuildCraftIndex, + ConfigPath: *configPath, + RunOnOwner: g.RunAdminOnOwner, + }) if err != nil { log.Fatalf("failed to start admin HTTPS server: %v", err) } -- cgit v1.2.3