Installable PWA with a share target; design for an item-based library
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:
1 parent
e2461f794c
commit
25b87b94fe
14 files changed
+637
-5
No files matched your search
@@ -212,6 +212,19 @@ class AppTest < Minitest::Test
|
||||
Maptool::App.const_set(:MAX_ZIP_UNCOMPRESSED, original)
|
||||
end
|
||||
|
||||
def test_pwa_manifest_is_served_as_a_manifest_and_declares_the_share_target
|
||||
response = request.get("/manifest.webmanifest")
|
||||
assert_equal 200, response.status
|
||||
assert_equal "application/manifest+json", response.content_type
|
||||
assert_equal "/share-target", JSON.parse(response.body).dig("share_target", "action")
|
||||
end
|
||||
|
||||
def test_share_target_without_a_service_worker_goes_back_to_the_map
|
||||
response = request.post("/share-target")
|
||||
assert_equal 303, response.status
|
||||
assert_equal "/", URI(response.location).path
|
||||
end
|
||||
|
||||
def test_corrupt_zip_is_rejected
|
||||
response = post_file("/api/gpx", filename: "bad.zip", content: "not a zip", content_type: "application/zip", env: logged_in_env)
|
||||
assert_equal 400, response.status
|
||||
|
||||
Reference in new issue
Block a user