Add Phase 6: multi-server admin panel (server registry + settings)

Gate a new /api/admin/* route set (register/list/update/delete servers)
behind a single shared MCMAPPER_ADMIN_TOKEN header, and add a /admin
frontend page (Alpine) to unlock, register new servers, and edit
authMode/anonymousChatAllowed/waypointFormat per server — these columns
already existed but were only editable via direct DB edit until now.

Written test-first per the project's TDD workflow: admin.ts's domain
logic, the index.ts route wiring, and a new e2e/tests/admin.spec.ts
covering the token gate and register/edit/delete round trip through the
real browser UI.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015tKdPZt78zbPUZMXWzKEKt
This commit is contained in:
2026-08-09 13:06:37 +02:00
parent 7b85f4dff1
commit a134c47152
13 changed files with 634 additions and 16 deletions
+5
View File
@@ -31,6 +31,10 @@ export const MINIO_SECRET_KEY = "mcmapper-e2e-only";
export const PROXY_ORIGIN = `http://localhost:${PROXY_PORT}`;
// Fixed, not random: admin.spec.ts needs to know it up front, and this only ever gates the
// throwaway e2e api instance.
export const ADMIN_TOKEN = "e2e-admin-token";
export const STATE_FILE = join(import.meta.dirname, ".e2e-state.json");
export type E2eState = {
@@ -41,6 +45,7 @@ export type E2eState = {
serverToken: string;
sessionToken: string;
accountId: string;
adminToken: string;
};
// Read by spec files — by the time tests run, global-setup.ts has already written this.