A logged-in user can now trigger, from a new "Offline data" sidebar panel, what was previously a fully manual go-pmtiles workflow (docs/development.adoc): regenerate either file for the current map viewport, no area-picker (same "visible area is the area" convention the Overpass POI plugin already uses). - lib/maptool/pmtiles_builder.rb: two independent background jobs (Thread + Mutex-guarded status Hash, same shape as app.rb's own GNSS poller), each writing to a .tmp path and atomically renaming into place so a build never serves a partially-written file mid-run. offline.pmtiles is a single `pmtiles extract` against Protomaps' public daily basemap build (byte-range extraction, not a full ~120GB download). terrain.pmtiles has no equivalent public Terrarium-encoded archive to extract from, so it fetches individual Terrarium tiles itself, packs them into an intermediate MBTiles (new sqlite3 gem), then the same `pmtiles convert`. - 4 new app.rb routes (POST .../build, GET .../build-status) plus size/mtime added to the existing availability endpoints. - public/js/offline_data.js: new sidebar panel, polling build-status the same self-rescheduling-setTimeout shape livetrack.js already uses for its own refresh loop. - Both network-heavy pieces (the Protomaps build index, per-tile fetches) are injectable, so test/test_pmtiles_builder.rb exercises the actual build pipeline against a fake `pmtiles` binary without hitting a real network, matching this suite's existing keep-it-offline convention for external services.
59 lines
2.8 KiB
ERB
59 lines
2.8 KiB
ERB
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>MapTool</title>
|
|
<link rel="stylesheet" href="/vendor/maplibre-gl/maplibre-gl.css">
|
|
<link rel="stylesheet" href="/css/style.css?v=<%= ASSET_VERSION %>">
|
|
</head>
|
|
<body>
|
|
<%= yield %>
|
|
<script>
|
|
// Caches radar tile images (see public/sw.js) so the last-seen frames
|
|
// stay visible once the network is actually gone. Silently a no-op
|
|
// where it can't register — insecure-context LAN access without a
|
|
// reverse proxy in front, for instance — same as radar caching simply
|
|
// not working there; nothing else on the page depends on this.
|
|
if ("serviceWorker" in navigator) {
|
|
navigator.serviceWorker.register("/sw.js").catch(() => {});
|
|
}
|
|
</script>
|
|
<script src="/vendor/pmtiles/pmtiles.js"></script>
|
|
<script src="/vendor/protomaps-themes-base/protomaps-themes-base.js"></script>
|
|
<script src="/vendor/maplibre-contour/maplibre-contour.min.js"></script>
|
|
<%# Vendored libs above don't change between deploys, so they're left
|
|
unversioned; app.js's own modules do, and map.js statically imports
|
|
them by bare path — an import map remaps those paths to a versioned
|
|
URL so editing e.g. gpx.js also busts its cache, without having to
|
|
touch every file's import statements. Must come before the module
|
|
script below: the importmap has to be parsed first. %>
|
|
<script type="importmap">
|
|
{
|
|
"imports": {
|
|
"/js/auth.js": "/js/auth.js?v=<%= ASSET_VERSION %>",
|
|
"/js/contour.js": "/js/contour.js?v=<%= ASSET_VERSION %>",
|
|
"/js/dem.js": "/js/dem.js?v=<%= ASSET_VERSION %>",
|
|
"/js/gnss.js": "/js/gnss.js?v=<%= ASSET_VERSION %>",
|
|
"/js/gpx.js": "/js/gpx.js?v=<%= ASSET_VERSION %>",
|
|
"/js/icons.js": "/js/icons.js?v=<%= ASSET_VERSION %>",
|
|
"/js/livetrack.js": "/js/livetrack.js?v=<%= ASSET_VERSION %>",
|
|
"/js/locate.js": "/js/locate.js?v=<%= ASSET_VERSION %>",
|
|
"/js/measure.js": "/js/measure.js?v=<%= ASSET_VERSION %>",
|
|
"/js/notes.js": "/js/notes.js?v=<%= ASSET_VERSION %>",
|
|
"/js/offline_data.js": "/js/offline_data.js?v=<%= ASSET_VERSION %>",
|
|
"/js/overlays.js": "/js/overlays.js?v=<%= ASSET_VERSION %>",
|
|
"/js/panels.js": "/js/panels.js?v=<%= ASSET_VERSION %>",
|
|
"/js/plugins.js": "/js/plugins.js?v=<%= ASSET_VERSION %>",
|
|
"/js/radar.js": "/js/radar.js?v=<%= ASSET_VERSION %>",
|
|
"/js/search.js": "/js/search.js?v=<%= ASSET_VERSION %>",
|
|
"/js/shadow.js": "/js/shadow.js?v=<%= ASSET_VERSION %>",
|
|
"/js/sun.js": "/js/sun.js?v=<%= ASSET_VERSION %>",
|
|
"/js/track_profile.js": "/js/track_profile.js?v=<%= ASSET_VERSION %>"
|
|
}
|
|
}
|
|
</script>
|
|
<script type="module" src="/js/map.js?v=<%= ASSET_VERSION %>"></script>
|
|
</body>
|
|
</html>
|