Commit Graph

7 Commits

Author SHA1 Message Date
Rokojori 7c754e4256 feat: auth session refresh overhaul — all 7 phases
Fixes two root-cause bugs: browser tabs racing the same single-use refresh
token, and Electron never refreshing after its one-shot startup call.

Browser:
- TokenUpdater: periodic 5-min + activity-triggered pings to /api/auth/me,
  EventSlot-driven valid/refreshing/expired/network-error state.
  Web Locks leader election (one tab runs the updater; others follow via
  BroadcastChannel). Falls back to leader-always without Locks API support.
- GuardedCall: three-tier wrapper (user/editor/silent) with pre-flight state
  check and tier-specific retry. Replaces ad-hoc fetch calls in Editor and
  editor-shell layout save/load.
- auth-connector: jwtMiddleware proactively rotates access-token cookie
  within 15 min of real expiry (server clock, no client-side exp needed).

Electron:
- Periodic token updater in main process: reads JWT exp directly, uses
  server-corrected clock (Date response header offset) for comparisons,
  refreshes within 15 min of expiry. Replaces one-shot startup refresh.
- Session heartbeat: running instance writes accessToken + timestamp every
  10 s. New instance mints its own session via POST /api/auth/new-session
  if heartbeat is ≤30 s old — skips login screen transparently.
- Retired plaintext last-password.txt auto-login.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-08-02 22:39:56 +02:00
Rokojori 4a72363aaf session 2026-07-18: Electron local dev fixes, nav z-index, board/outline/history update
Electron fixes:
- extractToken (auth-connector): Bearer header checked before cookie — prevents stale
  Electron session cookie from winning over injected token
- JWT_CLOCK_TOLERANCE env var: passed to jwt.verify as clockTolerance; set to 7200
  in .env to absorb ~65 min clock skew between Windows dev machine and prod auth server
- Startup token refresh: main.ts calls POST /api/auth/refresh before opening main window;
  shows login on failure instead of opening with expired tokens
- Quit-on-login fix: createMainWindow() is async; login-success now awaits it before
  closing the login window (zero windows → app.quit() race was killing the process)
- Credential persistence: email + password stored in userData; remember-me checkbox
  controls save behaviour; clear button removes saved files; fields pre-fill on load
- Electron session cookies cleared in createMainWindow() to avoid stale token reuse

CSS: z-index: 10 on .pld-nav (project-list-default) — fixed mobile nav buried under rows

Boards: cleared Done lane, added Electron fixes and nav z-index entries; backlog MVP
entry for local testing solution; bugs.html: 401-handling bug moved to Done.
Outline: auth card updated with extractToken order note and JWT_CLOCK_TOLERANCE docs.
History: Friday 18 July entry expanded with session 2 cards.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-18 08:37:47 +02:00
Rokojori 93f8c7bb33 tunneling: brainstorm, Phase 1 relay server built + tested, boards + history updated
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-16 07:27:48 +02:00
Rokojori 7c6fca54f9 history+boards+outline: styles.rokojori.com built, font migration, add-subdomain guide
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-15 20:39:06 +02:00
Rokojori 5e27849fa3 Styles Update 2026-07-15 17:13:06 +02:00
Rokojori 99f6f787ec Projects Udpate 2026-07-14 15:05:04 +02:00
Rokojori 5bcabe2c67 boards: task/bug/backlog boards, outline shortened, workspace index improved
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-14 14:34:47 +02:00