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.
This commit is contained in:
randy committed 2026-11-12 13:42:04 +01:00
1 parent e2461f794c
commit 25b87b94fe
14 files changed
+637 -5

No files matched your search

+11
View File
@@ -52,6 +52,9 @@ module Maptool
class App < Sinatra::Base
set :public_folder, File.join(__dir__, "public")
# The PWA manifest (public/manifest.webmanifest) — Rack doesn't know
# this extension and would serve it as application/octet-stream.
mime_type :webmanifest, "application/manifest+json"
set :views, File.join(__dir__, "views")
# sinatra/json defaults to MultiJson, whose `encode` (what
@@ -250,6 +253,14 @@ module Maptool
erb :index, locals: { logged_in: logged_in?, user: session[:user], revision: REVISION }
end
# A share to the installed app normally never reaches the server: the
# service worker (public/sw.js) takes the POST, parks the files and
# opens the app. Only lands here if no worker is running yet — back to
# the map rather than a 404, the share just has to be repeated.
post "/share-target" do
redirect "/", 303
end
get "/api/health" do
json status: "ok", revision: REVISION
end