No description
  • JavaScript 96.9%
  • CSS 2.9%
  • HTML 0.2%
Find a file
malice c1a000c285
Gate Traffic toggle on auth.authenticated (#3)
Root cause: /api/traffic is on Caddy's @authed_api, so when logged out
MapLibre's raster tile fetches receive a 302 to the Authentik login (HTML),
which it can't decode as an image and retries on every map move — console spam
and a stuck-feeling Traffic toggle.

Fix (frontend-only; /api/traffic stays auth-gated in Caddy):
- LayerControl: the Traffic toggle is always rendered but disabled (greyed,
  "Sign in to enable traffic" tooltip) until auth has loaded AND the user is
  authenticated — mirroring Panel.jsx's contacts gating. The add-traffic apply
  effect now also requires auth.authenticated (and lists it in deps), and the
  mount init only restores saved traffic=true when authenticated.
- Teardown on session -> anonymous: an effect flips traffic:false once auth has
  loaded and the user is not authenticated, which drives the apply effect to
  removeTrafficLayer (no further tile requests).
- MapView: the style-reload re-apply (which re-adds layers from localStorage on
  theme/style changes) now also checks auth.authenticated for traffic, so it
  can't re-add the source for an anonymous session — the second add path that
  would otherwise reintroduce the 302 retry loop.
- localStorage hydration: LayerControl now subscribes via useConfig() and its
  init effect depends on [config] instead of [], so saved layer prefs hydrate
  correctly once /api/config resolves (previously, mounting before config
  loaded left toggles stuck off and never re-initialized).

Shown-but-disabled (not hidden) so logged-in users see no flicker on reload
during the brief pre-whoami window.

Tests: the navi repo has no test infrastructure (no vitest/jest); bootstrapping
is out of scope. Follow-up: seed a vitest + RTL test asserting the Traffic
toggle is disabled when !auth.authenticated.

Co-authored-by: Matt Johnson <mj@k7zvx.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-22 16:40:49 -06:00
docs docs: add traffic-intelligent routing and Idaho 511 planned features 2026-05-08 07:02:00 +00:00
public feat: initial scaffold — Vite + React + Tailwind + MapLibre 2026-04-20 04:47:44 +00:00
src Gate Traffic toggle on auth.authenticated (#3) 2026-05-22 16:40:49 -06:00
.gitignore chore: add *.bak* to .gitignore 2026-04-27 02:50:54 +00:00
deploy.sh feat: search, multi-stop routing, and route display 2026-04-20 16:50:53 +00:00
eslint.config.js feat: initial scaffold — Vite + React + Tailwind + MapLibre 2026-04-20 04:47:44 +00:00
index.html feat(navi): GPS origin + place detail panel + basic actions 2026-04-20 20:59:18 +00:00
LICENSE Initial commit 2026-04-20 06:42:56 +02:00
package-lock.json fix: contour overlay with pmtiles fork, absolute URL, extended zoom range 2026-05-07 03:58:46 +00:00
package.json fix: contour overlay with pmtiles fork, absolute URL, extended zoom range 2026-05-07 03:58:46 +00:00
postcss.config.js feat: initial scaffold — Vite + React + Tailwind + MapLibre 2026-04-20 04:47:44 +00:00
README.md Initial commit 2026-04-20 06:42:56 +02:00
vite.config.js feat: search, multi-stop routing, and route display 2026-04-20 16:50:53 +00:00

navi

Navi — self-hosted navigation web frontend for Echo6