feat: base UI shell with themes, auth pages, profile, and role navigation (phase 4)

- embedded Go templates + vanilla ES-module JS + hand-written CSS, no build step
- exact §10 beige light / dark design tokens, square edges (radius 2px),
  system font stack, visible focus rings
- theme toggle persisted to localStorage and the user profile
- login/register/change-password pages wired to the auth API
- profile page: avatar upload (image-sniffed, old file cleanup), bio,
  contacts, arbitrary extra key/value fields, optimistic-concurrency 409
- role-based top navigation with placeholders for later-phase areas
- GET /files/{id} with scope-based access (session) or signed token (§5.1)
- security headers incl. CSP without unsafe-inline scripts

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
etalon
2026-06-12 18:39:38 +02:00
parent c1cc781279
commit 34bf5b5ac2
27 changed files with 1579 additions and 5 deletions
+22
View File
@@ -82,3 +82,25 @@ Spec-silent choices, recorded as required by the build instructions.
- **Mongo runs with `--wiredTigerCacheSizeGB 0.5`** in compose — the target
host has 4 GB RAM; default cache (≈50% of RAM) caused a restart under the
integration-test load.
## Phase 4
- **CSP has no `unsafe-inline` for scripts from day one** (§12), so all JS is
external ES modules (`theme.js` loads synchronously in `<head>` to avoid a
theme flash; everything else is `type=module`). Inline event handlers are
never used.
- **`PATCH /api/v1/profile` is a partial update**: only fields present in the
body change. `version` is optional — when present the update is
version-checked (409 + reload toast on conflict); the nav theme toggle
omits it so flipping themes can't conflict with a profile edit.
- **Avatar uploads must sniff as `image/*`**; the rejected/replaced GridFS
files are deleted eagerly. Replacing an avatar removes the previous file.
- **File serving (`GET /files/{id}`)**: valid signed token (?st=) OR session.
With a session: avatars are visible to any logged-in user; other scopes
(chat/task) currently allow owner/admin/consultant and will be tightened as
those features land.
- **Pages that need login redirect to `/login?next=…`** (HTML UX), while API
routes return 401 JSON. Forced password change redirects all pages to
/change-password.
- **Pages for later phases render an "under construction" placeholder** so
role-based navigation is complete and clickable now.