Commit Graph
229 Commits
Author SHA1 Message Date
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 e2461f794c Places index: also drop localities, isolated dwellings and kindless objects
Measured on France (5.3M rows): place=locality ~10% (mostly cadastral
names of fields and woods), isolated_dwelling ~5%, objects with a name
but none of the recognized kind keys ~4% (bus route relations etc.).
Schema version 3, so rake places:index rebuilds existing indexes.
2026-11-12 13:42:04 +01:00
randy f3dd37dd4e Places index: drop buildings and land use, search without apostrophes and by brand
CI / check (push) Successful in 18s
CI / deploy (push) Successful in 12s
Named buildings and land-use areas are skipped unless they're also a
shop/amenity/etc. A second, unshown FTS column holds the name without
apostrophes and the brand tag, so "mcdonalds" finds McDonald's and
"lidl" finds "Lidl Petržalka". The index records a schema version;
rake places:index rebuilds older ones by itself.
2026-11-12 12:58:31 +01:00
randy 8e4c466829 chore(deps): update dependency maplibre-gl to v6.18.0
CI / check (push) Successful in 17s
CI / deploy (push) Successful in 12s
2026-11-12 12:54:49 +01:00
randy 54e811ef95 chore(deps): update dependency suncalc to v2.1.4
CI / check (pull_request) Successful in 17s
CI / deploy (pull_request) Skipped
CI / check (push) Successful in 17s
CI / deploy (push) Successful in 13s
2026-11-12 11:52:17 +00:00
randy e63f6f7ce7 Enable YJIT in the container
CI / check (push) Successful in 19s
CI / deploy (push) Successful in 1m2s
The official Ruby image ships YJIT but leaves it off. Set via ENV so the
puma server and rake jobs run through podman compose exec both get it.
2026-11-12 12:27:42 +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 ba9c40ac3d Search: highlight the found spot, open a waypoint's popup, full-height list
A point result (typed coordinates, a geocoded place, a waypoint) leaves
a pulsing marker on the map until the next jump or a click on it. A
result from a layer opens that point's popup as if clicked on the map.
The panel grows to the window height so long result lists fit.
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 ca2e67599b Sun & moon chart: click the topbar's sun readout
A horizon-style chart drawn from the vendored suncalc, so fully offline:
real sun and moon altitude over the 24 h around solar noon, sunrise/
sunset lines, dawn/noon/dusk on the time axis, the moon in its current
phase, plus moonrise/set, phase and current sun/moon position below.
Polar day/night now shows as a label instead of hiding the readout.
2026-11-12 11:54:49 +01:00
randy cf483d183c Add a logged-in-only status/debug panel at the bottom of the sidebar
Dumps every read-only status endpoint (health, offline/terrain build
status, regions, caches, hiking trails, kiwix, plugins, GNSS, LiveTrack)
as JSON, refreshed every 5s while open so a running build's progress
shows live.
2026-11-12 11:37:42 +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 2611713489 chore(deps): update dependency maplibre-gl to v6.17.0
CI / check (pull_request) Successful in 21s
CI / deploy (pull_request) Skipped
CI / check (push) Successful in 16s
CI / deploy (push) Successful in 12s
2026-11-09 10:41:41 +00:00
randy c9534db3af chore(deps): update dependency minitest to v6.1.0
CI / check (push) Successful in 23s
CI / deploy (push) Successful in 32s
2026-11-09 11:40:11 +01:00
randy a1691f685b chore(deps): update dependency suncalc to v2.1.3
CI / check (push) Successful in 17s
CI / deploy (push) Successful in 13s
2026-11-09 11:39:54 +01:00
randy 5bd86a5325 chore(deps): update dependency maplibre-gl-lanes to v1.4.1
CI / check (pull_request) Successful in 33s
CI / deploy (pull_request) Skipped
CI / check (push) Successful in 35s
CI / deploy (push) Successful in 13s
2026-11-09 05:01:39 +00:00
randy 016fd8b6cb chore(deps): update dependency rubyzip to v3
CI / check (push) Successful in 17s
CI / deploy (push) Successful in 32s
2026-11-03 18:16:07 +01:00
randy 1e6c650024 Renovate: run in the official image instead of npm install
CI / check (push) Successful in 20s
CI / deploy (push) Successful in 13s
No per-run npm install (and its deprecation/allow-scripts warnings),
Node comes with the image so the engines.node mismatch can't recur,
and containerbase installs Ruby/bundler on demand for Gemfile.lock.
2026-11-03 18:12:53 +01:00
randy f313825da7 chore(deps): update dependency maplibre-gl-lanes to v1.4.0
CI / check (pull_request) Successful in 20s
CI / deploy (pull_request) Skipped
CI / check (push) Successful in 20s
CI / deploy (push) Successful in 13s
2026-11-03 17:08:44 +00:00
randy 240f7931c1 Renovate: pin its job to Node 24 and renovate@44
CI / check (push) Successful in 20s
CI / deploy (push) Successful in 13s
npm picks a Renovate version whose engines.node matches the runtime, so
the Node 26 bump silently downgraded Renovate to 37.x, which rejected
renovate.json (managerFilePatterns) and did nothing. Node majors for
this job are now excluded from Renovate's own bumps.
2026-11-03 18:07:48 +01:00
randy 8c6c47b6fd chore(deps): update dependency oauth2 to v2.1.0
CI / check (push) Successful in 21s
CI / deploy (push) Successful in 32s
2026-11-03 18:02:48 +01:00
randy 8b8ac386e9 chore(deps): update dependency ruby to v4.0.9
CI / check (push) Successful in 20s
CI / deploy (push) Successful in 13s
2026-11-03 18:02:37 +01:00
randy 7e420728a2 chore(deps): update dependency node to v26
CI / check (push) Successful in 21s
CI / deploy (push) Successful in 13s
2026-11-03 18:02:09 +01:00
randy 66163666e9 chore(deps): update actions/setup-node action to v7
CI / check (push) Successful in 20s
CI / deploy (push) Successful in 13s
2026-11-03 18:01:59 +01:00
randy e8e0208237 chore(deps): update actions/checkout action to v7
CI / check (push) Successful in 17s
CI / deploy (push) Successful in 12s
2026-11-03 18:01:40 +01:00
randy 21548d0f55 chore(deps): update dependency suncalc to v2.1.1
CI / check (push) Successful in 16s
CI / deploy (push) Successful in 13s
2026-11-03 18:01:28 +01:00
randy ac76f6d176 chore(deps): update dependency maplibre-gl to v6.16.0
CI / check (push) Successful in 18s
CI / deploy (push) Successful in 13s
2026-11-03 18:00:46 +01:00
randy 4a095f28db chore(deps): update dependency flag-icons to v7.6.0
CI / check (push) Successful in 16s
CI / deploy (push) Successful in 13s
2026-11-03 18:00:30 +01:00
randy 0870051893 Renovate: set up Ruby so it can run bundler lock
CI / check (push) Successful in 17s
CI / deploy (push) Successful in 12s
Gemfile.lock updates failed with 'spawn bundler ENOENT', the job only
had Node, leaving the oauth2/rubyzip PRs without a lockfile change.
2026-11-03 17:50:04 +01:00
randy 50ecc00aef Renovate: read GH_COM_TOKEN secret, drop hourly PR limit
CI / check (push) Successful in 17s
CI / deploy (push) Successful in 12s
Gitea reserves the GITHUB_ prefix for secret names, so
secrets.GITHUB_COM_TOKEN was always empty and github-releases/actions
lookups were skipped. prHourlyLimit 0: weekly runs, the default 2/hour
just leaves updates queued for weeks.
2026-11-03 17:43:34 +01:00
randy 33600f37a3 chore(deps): update dependency maplibre-contour to v0.1.1
CI / check (push) Successful in 21s
CI / deploy (push) Successful in 12s
2026-11-03 17:32:08 +01:00
randy 2e8a92b451 chore(deps): update dependency ruby to v4.0.9
CI / check (pull_request) Successful in 16s
CI / deploy (pull_request) Skipped
CI / check (push) Successful in 17s
CI / deploy (push) Successful in 1m2s
2026-11-03 16:23:23 +00:00
randy f62987b1de Add Renovate config, track vendored JS libs via package.json
CI / check (push) Successful in 36s
CI / deploy (push) Successful in 13s
The Renovate workflow had no renovate.json, so with onboarding off it
skipped the repo entirely. Now config:recommended plus a regex manager
for the Dockerfile's PMTILES_VERSION/PLANETILER_VERSION pins.

public/vendor/'s npm-published libraries (maplibre-gl, pmtiles,
maplibre-contour, maplibre-gl-lanes, flag-icons, suncalc) are pinned in
package.json; bin/vendor-sync.mjs copies them out of node_modules, and
runs as a Renovate postUpgradeTask so bump PRs carry the new files.
Re-syncing the current versions reproduces the vendored files exactly,
except suncalc's hand-added header, moved into third-party-notices.
2026-11-03 17:15:28 +01:00
randy 157759d44b compose: pin kiwix-serve to 3.8.2 instead of latest
Same image digest as latest today, just lets Renovate track it.
2026-11-03 17:15:28 +01:00
randy 2d6cdeaaf4 compose: shared :z on data mounts so kiwix can read its ZIM
CI / check (push) Successful in 40s
CI / deploy (push) Successful in 12s
maptool's private :Z on ./data recursively relabeled
data/kiwix/wikipedia.zim to maptool's own MCS label, locking the kiwix
container out of it ("Unable to add the ZIM file"), and kiwix's :Z
would do the same back. Both mount the same file, so the label has to
be shared.
2026-10-24 00:54:15 +02:00
randy efddc55ad0 refactor: enhance Overpass API handling with multiple endpoints and improved error reporting
CI / check (push) Successful in 19s
CI / deploy (push) Successful in 12s
2026-10-09 22:07:45 +02:00
randy 33be95ef59 Send a User-Agent to Overpass, overpass-api.de 406s Ruby's default
CI / check (push) Successful in 19s
CI / deploy (push) Successful in 13s
The Camper POIs plugin died with "plugin exited with status 1": Net::HTTP's
bare "Ruby" User-Agent now gets a 406 Not Acceptable from overpass-api.de,
any identifying one goes through.
2026-10-09 21:51:24 +02:00
randy ede21454a2 Draw offline hiking trails sharing a path as parallel lanes
CI / check (push) Successful in 22s
CI / deploy (push) Successful in 12s
Several marked routes running down one path drew as a single line, only
the topmost color visible. maplibre-gl-lanes puts each route in its own
lane; OSM relations already share exact vertices, which is all it needs.
One LaneLayer across every picked country; click hit-testing and the
highlight move to queryLane/setHighlight.
2026-10-09 21:46:05 +02:00
randy 9c80a20f3e compose: enable IPv6 on default network (fixes broken container DNS on brick)
CI / check (push) Successful in 38s
CI / deploy (push) Successful in 12s
2026-10-08 12:28:05 +02:00
randy 43785a074b Note the NPS arrowhead logo's official Pantone/RAL colors
CI / check (push) Successful in 38s
CI / deploy (push) Successful in 12s
Unrelated to anything the app renders, but the doc already collects
NPS-ecosystem color facts and this came up while sourcing colors
for a 3D print of the shield.
2026-09-21 18:08:35 +02:00
randy b0c93d10d7 Detect a LiveTrack session ending the moment Garmin confirms it, not 30min later
CI / check (push) Successful in 18s
CI / deploy (push) Successful in 12s
Watched the session from the last two commits actually get saved:
Garmin updated its `end` field from the future 24h placeholder to
within a second of the last point's own time, immediately — much
faster than the recency-of-last-point fallback alone would have
noticed (that only flips after ACTIVE_WITHIN with no new points, so a
just-saved session with a last point seconds old would still read as
active for up to 30 more minutes).

Now checks end-already-in-the-past first (authoritative and near
instant when Garmin has set it), falling back to point recency only
when end still shows the future placeholder — the case an abandoned,
never-saved session never updates.
2026-09-20 16:55:57 +02: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 8eada07869 Drop subject:LiveTrack from the Apps Script's Gmail search, it finds nothing
CI / check (push) Successful in 21s
CI / deploy (push) Successful in 12s
Documented as matching regardless of language, on the assumption
Gmail's subject: operator does a substring match — empirically false
against a real, currently-arriving LiveTrack email whose subject does
contain the word ("Sledujte LiveTrack používateľa ...", confirmed
2026-09-20): with the filter, the search returned zero threads;
removing it and rerunning found the email immediately. Left out
entirely rather than replaced — from:noreply@garmin.com plus the
session-link regex already narrows this down to real LiveTrack emails
with something usable in them.
2026-09-20 16:44:20 +02:00
randy 5d86cb1d04 Detect a live LiveTrack session from its last point, not session["end"]
CI / check (push) Successful in 40s
CI / deploy (push) Successful in 13s
session["end"].nil? was the active signal since this was first built,
on the assumption Garmin leaves it unset until the activity actually
stops. Checked directly against a real still-recording session today
(2026-09-20): end was already non-nil, set to exactly start + 24h — the
share link's own expiry, not an end time — so every currently-active
session was showing as "Ended". A genuinely ended session's end does
hold its real end time (confirmed against the 2026-09-06 session this
was originally, and only, verified against), which is what made the
bug easy to miss.

Recency of the last track point is a directly-observable signal
instead of reverse-engineering what a given `end` value means: Garmin
posts one roughly every postTrackPointFrequency seconds (~15, observed)
while genuinely still recording.
2026-09-20 16:42:52 +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
randy 9edc2d9534 Show clicked hiking trail info in a docked panel, not a popup
CI / check (push) Successful in 22s
CI / deploy (push) Successful in 12s
A map-anchored Popup on a trail click routinely overlapped the very
line it described. Follows the same click -> docked panel pattern
gpx.js already uses for a track line click (TrackProfilePanel) rather
than inventing a new one: a fixed #trail-panel docks to the right edge
on desktop and the bottom edge on narrow viewports (this file's first
@media breakpoint), so the trail stays fully visible either way.

routeHtml()'s own markup is reused unchanged for the panel body —
.trail-panel__body's padding matches .maplibregl-popup-content's own
(15px 10px) so the header's canceling negative margin still lines up.
The popup-identity staleness guard for the async Overpass lookup is
replaced with a plain request token, since there's no longer a fresh
Popup instance to key off of.
2026-09-15 12:52:54 +02:00
randy eada464fb3 Highlight trails in their own color instead of recoloring to yellow
CI / check (push) Successful in 22s
CI / deploy (push) Successful in 12s
2026-09-13 20:17:48 +02:00