design: fix first GM login bootstrap (#5)

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-10 18:04:11 +01:00
co-authored by Claude Haiku 5.5
parent 90576381df
commit ae2f7c48dc
2 changed files with 10 additions and 0 deletions
+8
View File
@@ -17,3 +17,11 @@ A lock condition meaning the token is pressed with no room: walls surround it, o
_Avoid_: blocked, crushed
Neither term names its cause. Stuck and squeezed both lock a token for its player in the same way; they differ only in why.
**GM**:
The one person who runs the table and sees everything: all walls, all tokens, all hidden state. A player can never become the GM.
_Avoid_: DM, admin, host
**Invite link**:
A secret link that admits one person to the table, with no password.
_Avoid_: invite code, join key, password
+2
View File
@@ -121,6 +121,8 @@ Notes:
- One cookie jar = one identity; same cookie in two tabs = same player, shared vision, both connections synced [MEASURED, prototype README].
- WS upgrade: authenticate by cookie **and** verify the `Origin` header equals the configured public origin [PROPOSED; mitigates cross-site WebSocket hijack, SameSite=Strict is the first line].
- Invite secrets are stored plaintext so the GM can re-copy the link [FIXED, Q11].
- **First GM login [FIXED, owner decision 2026-11-10, #5].** Only the server CLI creates the GM: `fff-vtt gm-link` creates the single GM player (role `gm`, display name `GM`) and a GM invite if none exists, and prints the full join URL (public origin from the same config the server reads). Re-running prints the same link; existing GM sessions are unaffected. `fff-vtt gm-link --new` rotates: new GM invite secret, old one invalid, all GM sessions revoked. `--new` refuses while the running server holds its lock on the data dir; the read-only print works at any time. Access control is filesystem permissions on the data files; no extra password. A visitor without an invite never becomes GM (no first-visitor claim); they see only a "need an invite" page. Renaming the GM is deferred to #6 (Players and invites).
- Rejected: env/config seed (secret leaks via config, repo, backups); auto-print at startup (secrets in logs); first visitor claims GM (takeover); rotate on every lookup (logs out GM devices); live rotation while the server runs (needs an admin channel to the running server).
### 3.3 Tiles
- Browser asks `GET /tiles/<scene>/<x>_<y>.png` (Nim path). Nim parses strictly (digits only, length-bounded, range-checked against scene size), checks the session's explored grid, and answers `200` with `X-Accel-Redirect: /_tiles/...` or `403`. nginx serves the bytes from an `internal` location; direct hits on `/_tiles/` give 404 [MEASURED: `prototype-server-vision/results/smoke.log`, README "Phase 2a"].