dragonflight/services/web-ui
opencode cfcbec0c85 fix(auth): make AUTH_ENABLED=true workable end-to-end
Three concrete issues kept the login flow broken on dragonflight.live:

1. mam-api trusted no proxy headers, so behind nginx/Cloudflare the
   session cookie's `secure` flag and the rate-limiter's IP keying
   both saw the wrong values. Now sets `app.set('trust proxy', 1)`.

2. Session config was tied to NODE_ENV and lacked sameSite/name. Now:
   - SESSION_COOKIE_SECURE env (default: true when AUTH_ENABLED) so a
     site behind HTTPS gets Secure cookies regardless of NODE_ENV.
   - `sameSite: 'lax'` for predictable post-login redirects.
   - Renamed to `df.sid` so it's obvious in DevTools.
   - `rolling: true` extends the 7-day TTL on active use.
   - SESSION_SECRET is now required when AUTH_ENABLED=true; the
     server refuses to start with a dev default in prod.

3. login.html silently showed the sign-in panel even when no users
   exist or auth is off:
   - New GET /auth/setup-status reports {needs_setup, user_count,
     auth_enabled}.
   - login.html calls it on load and auto-flips into setup mode when
     needs_setup is true, or shows an explicit "auth is off" flash
     when auth_enabled is false (the previous symptom: logout button
     did nothing because /auth/me returned a synthetic admin no matter
     what).
   - Added a `.flash.info` style for the new neutral notice.

4. Sidebar logout used to call /auth/logout then `window.location
   .reload()`. With auth off that reload landed back on the synthetic-
   admin app and looked like nothing happened. It now redirects to
   /login.html in all states so the operator sees feedback (and the
   server-side messaging about auth being off) instead of a no-op.

Deploy notes for zampp1:
  - Set AUTH_ENABLED=true and a random SESSION_SECRET in the
    mam-api environment (e.g. /opt/wild-dragon/.env).
  - Restart mam-api.
  - First load of /login.html will auto-route to the setup form so
    you can create the first admin.
2026-05-27 02:47:09 +00:00
..
public fix(auth): make AUTH_ENABLED=true workable end-to-end 2026-05-27 02:47:09 +00:00
scripts chore: 1.2 ship-prep sweep — close 38 issues 2026-05-27 02:06:14 +00:00
src/css rebrand: Dragonflight — ember orange accent (hue 266→32) 2026-05-21 22:16:32 -04:00
.dockerignore add services/web-ui/.dockerignore 2026-04-07 21:58:21 -04:00
.gitignore web-ui: fix corrupted .gitignore from earlier patch 2026-05-21 12:31:18 -04:00
Dockerfile chore: 1.2 ship-prep sweep — close 38 issues 2026-05-27 02:06:14 +00:00
nginx.conf feat: editor coming-soon bumper + embedded Premiere panel downloads 2026-05-26 14:34:28 +00:00
package.json chore: 1.2 ship-prep sweep — close 38 issues 2026-05-27 02:06:14 +00:00
postcss.config.js web-ui: fix wave-1 build pipeline (primitives missing from bundle) 2026-05-21 16:41:55 +00:00
tailwind.config.js web-ui: fix wave-1 build pipeline (primitives missing from bundle) 2026-05-21 16:41:55 +00:00