Commit Graph
91 Commits
Author SHA1 Message Date
randy 712c6bf7ad CAN trace on its own debug tab (/trace.html), off the CAN analyzer: records between Start and Stop only (polled every 0.5 s, the server keeps the last 5000 frames, lost ones counted, stops at 20000), the newest on top; sorted by any column, filtered by text (a, b = either), frame type, interface, node and only changes; Δ per ID; 1000 rows drawn, the filter and sort over all; export as candump .log (can-utils, SavvyCAN, python-can) or the shown rows decoded as CSV; SDO objects named by esphome-canopen's EDS (public/can/esphome.eds, from can2mqtt) and its entity objects 2026-12-02 19:05:07 +01:00
randy 7204355510 Dead reckoning in a tunnel: no fix for 3 s (or mode < 2) on the trip's route, the position carried along it (estimated: true, a grey arrow) by the car's CAN speed (vehicle.speed) when there is one, the average speed of the last ~20 s otherwise, up to 10 min (App.gnss_position, TripStore.ahead) 2026-12-02 18:24:47 +01:00
randy 7fdc0114e6 Debug pages switch between each other: one tab bar on top of /status.html, /can.html and /sim.html (views/_debug_nav.erb). CAN analyzer: a trace of every frame as it came (the server keeps the last 1000, GET /api/can?since=<seq> gives the new ones), each byte colored by what it is and decoded by its CANopen role — SDO command, index:subindex, expedited payload, segments, abort codes, byte 0 in bits; NMT, heartbeat, EMCY, SYNC, PDOs; who sent it, Δ ms, pause, clear, the frame filter
CI / check (push) Successful in 22s
CI / deploy (push) Successful in 17s
2026-12-02 18:22:16 +01:00
randy bd689faa93 Trip log crash-safe like a FIT: an append-only journal per trip (data/trip_log/<started>.ndjson, fsynced every 5 s, a torn last line skipped and the next one on a line of its own), a restart picks the running trip up from it into the same track, no state file to corrupt; the library's track built from it every 5 min and at the end. Drive mode: a pinned side panel's room goes back to the map
CI / check (push) Successful in 43s
CI / deploy (push) Successful in 17s
2026-12-01 10:14:57 +01:00
randy 0c809b3e2b GNSS simulation on its own diagnostics page (/sim.html: drive the trip's route or randomly, stop, simulated time, the position and the trip); along the route with a detour now and then (300–800 m off every 3–8 km, routed by Valhalla); simulated time 1–20× with the fixes carrying the simulation's clock, so a recorded trip keeps real speeds (PUT /api/sim/gnss); /api/can says simulated
CI / check (push) Successful in 21s
CI / deploy (push) Successful in 17s
2026-12-01 02:31:31 +01:00
randy 7d72e9eb63 Trip log: a trip is a library folder (Trips/<date> <name>) with the planned route and its stops; the car's GNSS recorded into its track there (10 m steps, written every minute and at the end), GET/POST/DELETE /api/trip/log; the Trip menu's Start / End and the line really driven (--route-driven); along-route POI mode for the plugins in TODO
CI / check (push) Successful in 21s
CI / deploy (push) Successful in 17s
2026-12-01 02:25:20 +01:00
randy 809e88ab1a Driving menu Trip: the stops as big rows (look, ✓ passed, ↑ ↓, ✕), a stop at the crosshair, the start at the car, search of saved points and offline places; each leg's km and time (legs_s) and the total, in the route panel too; passed stops kept (not routed, dimmed, editable) — a reroute marks them instead of dropping them; /status.html: every status endpoint full width (the debug panel links it); the trip-as-plan-and-log model and planned-vs-driven colors in docs/TODO
CI / check (push) Successful in 22s
CI / deploy (push) Successful in 17s
2026-12-01 02:21:14 +01:00
randy 7fcac61c99 Simulation along the trip's route ("Simulate driving the route" when there is one, POST /api/sim/gnss {"trip": true}), random trips after it
CI / check (push) Successful in 21s
CI / deploy (push) Successful in 17s
2026-12-01 01:45:38 +01:00
randy 07a4d363ec Driving mode ("Drive": big buttons — follow, zoom, 2D/3D, night, route overview — the sidebar hidden); palettes instead of the inversion (the UI's greys onto --ui-*, MapLibre's controls too, night → Night, new ◑ Dusk); the navigated route magenta, the driven part dimmed; route progress only forward (locate near the last position first); rerouting on the server off its own GNSS (TripStore#follow), the browser's only without the shared trip; the overview map hidden while following in 3D; the topbar's items apart
CI / check (push) Successful in 21s
CI / deploy (push) Successful in 17s
2026-12-01 01:44:54 +01:00
randy a11a71dc89 Status / debug: "Check for an update now" — past the update check's 10 min cache
CI / check (push) Successful in 22s
CI / deploy (push) Successful in 18s
2026-11-30 20:27:58 +01:00
randy e92f01db12 Nodes describe themselves: an SDO client (Can::Sdo) reads each esphome-canopen node's TPDOs and entities (type, name, unit, range) on its first heartbeat, cached by the TPDO layout hash, decoded with no hand-written signals — can.json keeps aliases (with unit conversion) and foreign devices; design doc (NPS planning, cockpit instruments, Unigrid band) with color tokens, the dashboard in cockpit colors; starting the simulation turns the GNSS follow on, the GNSS position an arrow by its course
CI / check (push) Successful in 23s
CI / deploy (push) Successful in 17s
2026-11-30 19:51:03 +01:00
randy 17891c53b5 Shared trip: one itinerary per server (data/trip.json, GET/PUT /api/trip, routed server-side), the route panel edits it when logged in and polls other screens' changes in without moving the camera; the GNSS simulation skips trips under 1 km and starts elsewhere when it can't get on from a road island; the car's server updates itself from a topbar button (SELF_UPDATE=1: newer main with CI passed → bin/update-maptool.sh via maptool-update.path); Android Auto and the trip's next steps in TODO
CI / check (push) Successful in 22s
CI / deploy (push) Successful in 17s
2026-11-30 19:19:37 +01:00
randy 5f4c7c6ee8 Navigation: rerouting off the route (30 m for 3 fixes, HDOP ≤ 5, every 15 s at most) from the position to the points not reached yet; lanes as SVG arrows, the ones to take bold; dashboard background see-through with a slider; the GNSS simulation starts at a random place in the offline countries, the map jumping there
CI / check (push) Successful in 22s
CI / deploy (push) Successful in 18s
2026-11-30 19:11:07 +01:00
randy 8680cdbee7 GNSS course worked out server-side (App.gnss_update, for the CAN node and the simulation, which send none): following in 3D turns heading-up behind the position again
CI / check (push) Successful in 23s
CI / deploy (push) Successful in 17s
2026-11-30 18:45:32 +01:00
randy 190a8ad334 Dashboard overlay (Overlays → Live → Dashboard): one inclinometer (compass ring, roll and pitch), speed, the speed limit with an over-limit warning and, on the route, the next limit change, traffic signal, maneuver and its lanes; /api/route gains speed_limits, signals and lanes, POST /api/road gives the driven road's limit; GNSS simulation (random trips over Valhalla) for trying it without the car; the HMC5883L heading in can.json
CI / check (push) Successful in 24s
CI / deploy (push) Successful in 17s
2026-11-30 18:30:21 +01:00
randy 5c023619ec Map data pull over brick's nginx: X-Accel-Buffering: no on map files (buffered, nginx's 1 GB temp file cap ended every bigger download there); each attempt resumes from the part on disk (curl's --retry kept its first offset); a file that can't be written is skipped, not the whole run
CI / check (push) Successful in 21s
CI / deploy (push) Successful in 17s
2026-11-29 17:52:02 +01:00
randy 62045be0f7 TRUSTED_NETWORKS=connected: requests from the subnets the server's interfaces are on right now count as logged in (the car's server, whichever Wi-Fi it's on); CIDRs still work alongside
CI / check (push) Successful in 21s
CI / deploy (push) Successful in 23s
2026-11-29 17:19:13 +01:00
randy f9fbcdbbc5 Map data pull: of kiwix/ only the served wikipedia.zim, not the other ZIMs lying there (65 GB)
CI / check (push) Successful in 21s
CI / deploy (push) Successful in 17s
2026-11-29 13:13:02 +01:00
randy 6a0d6194fe CANopen diagnostics and map data over HTTPS: /can.html (interfaces, nodes with heartbeat state and last EMCY, decoded signals, every COB-ID with role, count, rate and last data); signals can mark an invalid raw value (esphome-canopen's unknown) and NaN gives no value; the CAN reader never dies and a broken can.json only turns CAN off; the GNSS node mcu-stm32-xiao-c5-2 (0x21) and host networking for the car's server in docs; bin/pull-maps.sh pulls map data from GET /api/sync/maps(/file) with SYNC_TOKEN instead of rsync over SSH, resuming cut-off downloads
CI / check (push) Successful in 42s
CI / deploy (push) Successful in 18s
2026-11-29 12:47:23 +01:00
randy dbe742321a Library sync OsmAnd-style: brick is the server, a client (the car's maptool, SYNC_SERVER_URL) syncs on its Sync button — pulls the server's rows, pushes its own with the source files the server lacks, newer updated_at wins; /api/sync/* guarded by SYNC_TOKEN (written into brick's .env by CI). TRUSTED_NETWORKS logs in the car's LAN (no Gitea offline); TAKEOUT_HOST_DIR for a server without the Takeout; bin/pull-maps.sh pulls map data one way while at home
CI / check (push) Successful in 22s
CI / deploy (push) Successful in 18s
2026-11-27 23:22:32 +01:00
randy 850a5946ad Native CAN (the van's final setup, MQTT the stopgap): SocketCAN on any number of interfaces, CANopen frame roles, heartbeat states and NMT start, signals decoded by data/can.json (id/mask, byte/bit, type, scale/offset, unit); gnss.* signals feed the GNSS control, GET /api/can; tested over vcan0
CI / check (push) Successful in 20s
CI / deploy (push) Successful in 17s
2026-11-27 22:48:46 +01:00
randy f0ff5f390f Hiking trails: the main checkbox loads the countries in view from zoom 10 (and those panned into), not all at once — together ~1 GB of GeoJSON the browser never finished; /api/hiking-trails also sends each country's bbox 2026-11-27 14:29:29 +01:00
randy 49900c1703 Drop gpsd support and the GNSS simulator service: the car's GNSS comes over CAN later; /api/gnss/position and the GNSS control stay, fed through GNSS_LATEST
CI / check (push) Successful in 20s
CI / deploy (push) Successful in 17s
2026-11-27 13:59:53 +01:00
randy 0aee739ac3 Google Maps saved lists from a scheduled Google Takeout: hourly check of TAKEOUT_DIR (brick's Drive backup, mounted read-only), the zip with Takeout/Saved/*.csv picked by its central directory (photo parts skipped), each list into Google Maps/<list>; positions decoded offline from the place's S2 feature id and refined by Nominatim, unresolved ones flagged approximate in the popup (cleared when moved by hand); points matched by Google id per folder, so a new export updates them (own color/icon/position kept, deleted stay deleted)
CI / check (push) Successful in 8m56s
CI / deploy (push) Successful in 38s
2026-11-25 15:10:30 +01:00
randy 2470099877 Login lasts 90 days instead of the browser session — Android dropped the session cookie whenever it killed the browser/PWA, forcing a fresh Gitea login + MFA
CI / check (push) Successful in 19s
CI / deploy (push) Successful in 17s
2026-11-23 15:04:17 +01:00
randy 0e5f79f8e4 Tracker and ITS-G5 as separate overlays, Overlays grouped by category: the tracker gets a name/icon/color, charging from its USB power topic, a floating info card (per-device opacity), a trail of the last 1–24 h and optional position logging that survives restarts (LiveStore); hiking trails keep their main checkbox as an all-countries toggle
CI / check (push) Successful in 20s
CI / deploy (push) Successful in 18s
2026-11-19 11:57:36 +01:00
randy 3fc8c75c60 NPS park maps overlay: park points and map footprints, a park search, a park popup listing its Harpers Ferry Center maps with local PDF/GeoTIFF links, and the 289 georeferenced ones laid over the base map with an opacity slider; data from data/nps served by /api/nps and /nps/{overlay,geotiff,pdf}
CI / check (push) Successful in 19s
CI / deploy (push) Successful in 17s
2026-11-19 10:52:17 +01:00
randy ff5924faf1 Offline regions for the whole world: the region list comes from Geofabrik's index (bin/geofabrik-regions-sync.mjs → geofabrik_regions.geojson, 193 countries plus subregions like the US states), keeping the European ISO codes; the picker folds it by continent with a search box and subregions under their country, flags for all of them
CI / check (push) Successful in 19s
CI / deploy (push) Successful in 17s
2026-11-19 10:03:47 +01:00
randy 02c2ef05f8 Vehicle & ITS-G5 overlay: a stdlib MQTT subscriber (MQTT_URL/USERNAME/PASSWORD) keeps the car's LTE tracker position and the ITS-G5 stations heard by mcu-its-g5 (decoded header, stations expire after 60 s), served by /api/live and drawn as a car badge plus stations colored by type with DENM in red; Meshtastic noted in TODO
CI / check (push) Successful in 21s
CI / deploy (push) Successful in 18s
2026-11-19 00:46:26 +01:00
randy 3e5fada66a Legend page served as a view with the map's versioned importmap (shared partial): as a static page it imported icons.js and mdi.mjs unversioned and a browser with an older copy showed no symbols; it also stays light (color-scheme) since auto-darkening washed out its swatches, no autofocus, a clearer filter and a symbol count
CI / check (push) Successful in 19s
CI / deploy (push) Successful in 18s
2026-11-18 23:47:07 +01:00
randy a21e2b0bc6 Static files sent with Cache-Control: no-cache (revalidated, a 304 when unchanged): unversioned /vendor modules were cached heuristically, so a tablet kept the old mdi.mjs after the deploy that added the lock icons and the new icons.js failed to import from it, leaving a blank map
CI / check (push) Successful in 18s
CI / deploy (push) Successful in 18s
2026-11-18 23:24:15 +01:00
randy 4265421457 Tracks and routes as containers of points: listed (collapsed) under them in the tree, added via a point's popup, a new note or the route planner's navigation pins, and written as course points into the FIT course
CI / check (push) Successful in 18s
CI / deploy (push) Successful in 18s
2026-11-18 12:39:04 +01:00
randy 3e487539bc Re-read already-uploaded tracks once so their profiles get power and temperature
CI / check (push) Successful in 19s
CI / deploy (push) Successful in 22s
2026-11-16 18:46:58 +01:00
randy f8755ea65a Bicycle and foot route profiles (Valhalla bicycle/pedestrian costing); hiking trail colours in the elevation profile; power, splits and best efforts in the profile; TCX import; FIT course export
CI / check (push) Successful in 19s
CI / deploy (push) Successful in 18s
2026-11-16 12:18:06 +01:00
randy 69aa284e36 Vehicle profiles (Car, Camper, ...), avoid tolls/motorways, per-country vignette and toll km for a route
CI / check (push) Successful in 19s
CI / deploy (push) Successful in 17s
2026-11-14 21:20:23 +01:00
randy 59447c56f2 Library phase 3: change feed and folder export for Locus (GPX) and OsmAnd (favourites + tracks zip)
CI / check (push) Successful in 20s
CI / deploy (push) Successful in 13s
2026-11-13 23:00:07 +01:00
randy cca985d2b9 Route elevation profile (climb, descent, max grade) from the terrain tiles, and reach (isochrones) in the route panel 2026-11-13 22:55:55 +01:00
randy 3146478c23 Offline routing phase 2: route panel, /api/route via Valhalla, vehicle profile, save a route to the library 2026-11-13 22:34:47 +01:00
randy bf912b96e5 Offline routing phase 1: valhalla container building from the offline map's extracts, status in the Offline data panel
CI / check (push) Successful in 55s
CI / deploy (push) Successful in 2m48s
2026-11-13 21:24:19 +01:00
randy 6f5f11cb4d Library phase 2: rename/recolor nodes, rename and move folders, split a layer into items; offline routing design 2026-11-13 21:16:35 +01:00
randy ad8b72c3d3 Library phase 1: SQLite item library with folders, migration of old files as layers, import split into items 2026-11-13 09:03:22 +01:00
randy 25b87b94fe Installable PWA with a share target; design for an item-based library
CI / check (push) Successful in 18s
CI / deploy (push) Successful in 13s
Android's share sheet (OsmAnd, Locus, mapy.com, ...) can now send
GPX/FIT/GeoJSON/ZIP files to the installed app: the service worker parks
them and the page offers to import them into a Tracks & Points folder,
waiting through a login if needed. Manifest, app icon, a server-side
fallback for /share-target.

docs/library-design.adoc proposes replacing the file-based GpxStore with
folders and items (stable ids, timestamps, tombstones, a change feed) as
the base for syncing with OsmAnd and Locus.
2026-11-12 13:42:04 +01:00
randy 3f973a26d7 Search the offline map and Wikipedia, nearest results first
CI / check (push) Successful in 26s
CI / deploy (push) Successful in 33s
Every named OSM object in each country's Geofabrik extract goes into a
SQLite FTS5 index (data/places/<CODE>.sqlite, lib/maptool/places.rb),
built as the last offline-build step or on its own with
rake places:index. Kiwix full-text search is another source; clicking a
hit opens the article. Results from every source are sorted by distance
from the map center (settlements weighted closer) and show it; each
source is queried separately so a slow one doesn't hold up the list.
2026-11-12 12:13:13 +01:00
randy 81e688be9b Record per-step timings of offline/terrain builds
CI / check (push) Successful in 38s
CI / deploy (push) Successful in 12s
Live in build-status while running; every finished build (done or
error) is appended to data/build_history.jsonl with its step timings,
regions, thread count and, for offline builds, the tail of Planetiler's
output (its own per-phase summary). GET /api/build-history, shown in the
debug panel, gives a baseline to compare later builds against.
2026-11-12 11:54:49 +01:00
randy 7429e4ae33 Zip upload: reject archives over 500 MB uncompressed
Sums the entries' declared sizes before extracting anything; rubyzip's
own validate_entry_sizes (on by default) catches an entry that inflates
past what it declared.
2026-11-12 11:54:49 +01:00
randy 0051a0337c Search: look through all saved layers and offline hiking trails
GET /api/search (lib/maptool/search.rb) matches feature name and
description, case- and diacritics-insensitive, across every file in
Tracks & Points (shown or not) and every offline hiking-trails country.
Parsed features are cached in memory per file by mtime.

The search box now queries local sources and Nominatim side by side,
labels each result with where it was found, lets you untick sources,
and switches a result's layer on if it was off before zooming to it.
2026-11-12 11:37:42 +01:00
randy 3106f8c103 Draw a LiveTrack session's planned course alongside the actual track
CI / check (push) Successful in 19s
CI / deploy (push) Successful in 13s
Garmin's own LiveTrack page already shows both when the activity was
started from a saved course — the session payload carries the course's
geoPoints right alongside the track points (LiveTrackClient found it
nested under the same React Query cache the session/points come from).

Rendered as a second, dashed LineString distinct from the actual
track's own line ("kind": "actual" vs "planned" on each GeoJSON
feature) — muted gray rather than matching Garmin's own purple-for-
planned, since this app's actual track is already purple and reusing
it would make the two indistinguishable.
2026-09-20 16:54:24 +02:00
randy b7618edc25 Move the session-skip from a before filter to real Rack middleware
CI / check (push) Successful in 19s
CI / deploy (push) Successful in 12s
The before filter added in the previous commit never ran for static
assets: Sinatra serves public_folder files (every JS/CSS/font/vendor
file) through its own built-in shortcut, bypassing route and filter
dispatch entirely — confirmed live, curl still got a fresh set-cookie
on /js/map.js after that commit deployed, and the user hit the exact
same logout on refresh again. A HAR from that retest shows the same
clobbering pattern as before, just via a different response each time.

SkipSessionWrite is a plain Rack middleware instead, positioned (via
`use`, after `set :sessions`) inside Rack::Session::Cookie's own
wrapping — it sees the same env static dispatch does, so every response
is covered, not just Sinatra-routed ones.
2026-09-16 18:03:28 +02:00
randy bd46b72144 Skip re-writing the session cookie on every response, not just the three that change it
CI / check (push) Successful in 19s
CI / deploy (push) Successful in 12s
Rack::Session::Cookie re-serializes and re-sets the cookie on every
response that even reads session — Rack::Protection's CSRF check does,
on nearly every request — reflecting whatever cookie that particular
request happened to arrive with, whether or not anything actually
changed. A HAR capture caught the real failure mode: seconds after a
successful login, offline_data.js's _checkUpdate (an unrelated
background poll fired the instant the page loads) was still carrying
the browser's pre-login cookie — a client-side timing race across the
OAuth redirect chain, not something this server controls — and its own
re-issued Set-Cookie landed after the login's, silently overwriting
session[:user] with nothing logged anywhere to explain it.

Only /login, /auth/callback and /logout ever actually write to
session. A before filter now skips the write everywhere else, removing
every other response from that race — a stale request can still read a
stale cookie, but it can no longer clobber a fresher one.

Also drops the earlier except: [:session_hijacking] from the previous
commit: rack-protection 4.2.1 only enables SessionHijacking when
explicitly opted into via :use, so Sinatra's default setup never turned
it on in the first place — the exclusion was a no-op, not the fix.
2026-09-16 17:56:44 +02:00
randy 6126b5055b Disable Rack::Protection::SessionHijacking, it silently logs everyone out
CI / check (push) Successful in 37s
CI / deploy (push) Successful in 19s
Sinatra turns this on by default once sessions are enabled: it pins a
session to the User-Agent header seen on whichever request first wrote
to it, and empties the session — no exception, nothing logged — on any
later request where that header doesn't match. That's exactly what
production hit behind its reverse proxy: OAuth login set session[:user]
fine, then the very next page load (even a plain refresh) came back
logged out with nothing in the logs to explain why.

Its own docs concede every header it checks is spoofable anyway ("will
not prevent determined hijacking attempts"), so losing it is a minor
tradeoff for a login that actually stays logged in. Every other
Rack::Protection check stays on.
2026-09-16 16:11:01 +02:00