Rebuild the admin dashboard as a Svelte 5 + TypeScript app

Frontend in web/ (Vite via bun, pure CSS, no component libraries),
built to internal/dashboard/dist and embedded into the binary; the
Dockerfile builds it in a bun stage. Old static dashboard.html removed.
This commit is contained in:
2026-10-25 16:34:21 +08:00
parent f5fcdd7bbb
commit bc52af33cf
24 changed files with 760 additions and 183 deletions
+14 -5
View File
@@ -54,13 +54,22 @@ Every flag also reads an environment variable (`tunneld -h`):
## Admin dashboard
With `ADMIN_TOKEN` set, `https://<domain>/` (and `/admin`) serves a small
self-contained dashboard: server uptime and version, CA expiry, tunnels with
With `ADMIN_TOKEN` set, `https://<domain>/` (and `/admin`) serves the admin
dashboard: server uptime and version, CA expiry, tunnels with
state/routes/cert expiry, and attached bridges with client version and live
connection counts. The page stores the token in `localStorage` and polls
connection counts. It is a Svelte 5 + TypeScript app (pure CSS, no component
libraries) in `web/`, built with bun and embedded into the binary; it polls
`GET /api/admin/overview` (`Authorization: Bearer <ADMIN_TOKEN>`) every 5
seconds. Without `ADMIN_TOKEN` the endpoint answers 503 and the page is
inert; with a wrong token, 401.
seconds and stores the token in `localStorage`. Without `ADMIN_TOKEN` the
endpoint answers 503 and the page is inert; with a wrong token, 401.
```bash
cd web && bun install
bun run build # writes internal/dashboard/dist (gitignored), embedded by go:embed
bun run check # svelte-check
```
The Dockerfile builds the frontend in a bun stage before the Go build.
## Deploy on Coolify (or any Docker host)