Link POI popups to offline Wikipedia via kiwix-serve
CI / check (push) Successful in 40s
CI / deploy (push) Successful in 12s

lib/maptool/kiwix.rb: a small reachability check for an external
kiwix-serve instance. GET /api/kiwix reports it (same optional-
integration pattern as offline-tiles/terrain-tiles); the frontend
adds a "Nearby on Wikipedia" link to a point's popup pointing straight
at kiwix-serve's own geo search (GET /search?latitude=&longitude=
&distance=, confirmed from libkiwix's actual source rather than
guessed) — linked to directly, not proxied/embedded, since it already
has a full search UI of its own.

docker-compose.yaml: new `kiwix` service (ghcr.io/kiwix/kiwix-serve)
on the default network, KIWIX_URL wired to reach it by service name.
The ZIM itself isn't part of the repo (large, self-contained archive)
— data/kiwix/ gitignored same as the *.pmtiles files, setup steps in
docs/development.adoc.

No kiwix-serve/ZIM available here to test end-to-end — verified the
app side against a stand-in local HTTP server (GET /api/kiwix flips
available correctly) and confirmed the generated popup link matches
the real geo-search query shape. docker-compose.yaml validated with
`docker-compose config`. Full test suite: 118 runs, 0 failures.
This commit is contained in:
randy committed 2026-09-09 13:44:37 +02:00
1 parent 7cd3171998
commit 24ac5931f8
13 files changed
+150 -9

No files matched your search

+5
View File
@@ -23,6 +23,11 @@ class AppTest < Minitest::Test
assert_equal({ "available" => false }, json_body(response))
end
def test_kiwix_reports_unavailable_when_no_url_configured
response = request.get("/api/kiwix")
assert_equal({ "available" => false, "url" => "" }, json_body(response))
end
def test_gnss_position_unavailable_with_no_fix
response = request.get("/api/gnss/position", **logged_in_env)
assert_equal({ "available" => false }, json_body(response))
+18
View File
@@ -0,0 +1,18 @@
require_relative "test_helper"
require "maptool/kiwix"
# No real network calls — a blank URL and a guaranteed-local connection
# refusal are both fully offline/deterministic; simulating a genuine
# reachable kiwix-serve would need spinning up a real HTTP server for what
# is, at heart, a two-line Net::HTTP wrapper — not worth it, same
# restraint LiveTrackClientTest already applies to its own network path.
class KiwixTest < Minitest::Test
def test_reachable_is_false_for_a_blank_url
refute Maptool::Kiwix.reachable?("")
refute Maptool::Kiwix.reachable?(nil)
end
def test_reachable_is_false_when_nothing_is_listening
refute Maptool::Kiwix.reachable?("http://127.0.0.1:1", open_timeout: 1)
end
end