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
+3
View File
@@ -12,6 +12,7 @@ import { execSync, spawn, type ChildProcess } from "node:child_process";
import { writeFileSync } from "node:fs";
import postgres from "postgres";
import {
ADMIN_TOKEN,
API_DIR,
API_PORT,
DATABASE_URL,
@@ -145,6 +146,7 @@ export default async function globalSetup() {
MINIO_USE_SSL: "false",
MINIO_ACCESS_KEY,
MINIO_SECRET_KEY,
MCMAPPER_ADMIN_TOKEN: ADMIN_TOKEN,
});
await waitFor(() => httpOk(`http://localhost:${API_PORT}/health`), "api");
@@ -171,6 +173,7 @@ export default async function globalSetup() {
serverToken,
sessionToken,
accountId: account!.id,
adminToken: ADMIN_TOKEN,
}),
);