From 92cc0c87edfffbab6acd835d8522b844e1677a75 Mon Sep 17 00:00:00 2001 From: Roman Priesol Date: Wed, 9 Sep 2026 17:38:53 +0200 Subject: [PATCH] Wire up p4n2gpx as a private plugin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit data/plugins/p4n2gpx/ (outside git, see .gitignore) now holds a plugin.json + run.rb wrapper around ../p4n2gpx/ruby/p4n2gpx.rb, so it runs through the same --south/--west/--north/--east-in, GeoJSON-on-stdout-out contract as the built-in overpass-pois plugin. run.rb converts the requested bbox to the center+radius p4n2gpx.rb itself expects, then reuses lib/maptool/gpx.rb to turn its .gpx output into GeoJSON. p4n2gpx.rb needs faraday-cookie_jar, which wasn't in the Gemfile yet (faraday itself already was, transitively via oauth2) — added and locked. Also wires P4N_USER/P4N_PASSWORD through docker-compose.yaml and the deploy workflow's "Write .env" step, the same optional-secret pattern as LIVETRACK_WEBHOOK_SECRET, since the container has no browser for p4n2gpx.rb's Chrome-cookie auth fallback. --- .gitea/workflows/ci.yml | 2 ++ .gitignore | 6 ++++++ Gemfile | 2 ++ Gemfile.lock | 10 ++++++++++ data/plugins/.gitkeep | 0 docker-compose.yaml | 7 +++++++ 6 files changed, 27 insertions(+) create mode 100644 data/plugins/.gitkeep diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 51071f8..8845806 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -99,6 +99,8 @@ jobs: GITEA_OAUTH_CLIENT_SECRET=${{ secrets.OAUTH_CLIENT_SECRET }} MAPTOOL_ALLOWED_GITEA_USER=${{ secrets.MAPTOOL_ALLOWED_GITEA_USER }} LIVETRACK_WEBHOOK_SECRET=${{ secrets.LIVETRACK_WEBHOOK_SECRET }} + P4N_USER=${{ secrets.P4N_USER }} + P4N_PASSWORD=${{ secrets.P4N_PASSWORD }} EOF chmod 600 /srv/podman/maptool/.env diff --git a/.gitignore b/.gitignore index 3008a4a..7a91330 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,12 @@ # Garmin LiveTrack session IDs received via webhook /data/livetrack.json +# Private import plugins (see lib/maptool/plugins.rb's PLUGINS_DIRS, +# docs/deployment.adoc) — a plugin whose ToS forbids living in this public +# repo belongs here instead, outside git entirely. +/data/plugins/* +!/data/plugins/.gitkeep + # Editor / OS .DS_Store *.swp diff --git a/Gemfile b/Gemfile index 629866e..c529183 100644 --- a/Gemfile +++ b/Gemfile @@ -15,3 +15,5 @@ group :test do gem "minitest", "~> 6.0" gem "rake", "~> 13.0" end + +gem "faraday-cookie_jar", "~> 0.0.8" diff --git a/Gemfile.lock b/Gemfile.lock index 00f3dcf..db423d5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -7,11 +7,15 @@ GEM version_gem (~> 1.1, >= 1.1.14) base64 (0.3.0) bigdecimal (4.1.2) + domain_name (0.6.20260902) drb (2.2.3) faraday (2.14.3) faraday-net_http (>= 2.0, < 3.5) json logger + faraday-cookie_jar (0.0.8) + faraday (>= 0.8.0) + http-cookie (>= 1.0.0) faraday-net_http (3.4.4) net-http (~> 0.5) ffi (1.17.4-aarch64-linux-gnu) @@ -26,6 +30,8 @@ GEM ffi (1.17.4-x86_64-linux-musl) hashie (5.1.0) logger + http-cookie (1.1.6) + domain_name (~> 0.5) json (2.21.2) jwt (3.2.0) base64 @@ -106,6 +112,7 @@ PLATFORMS x86_64-linux-musl DEPENDENCIES + faraday-cookie_jar (~> 0.0.8) minitest (~> 6.0) oauth2 (~> 2.0) puma (~> 8.0) @@ -122,8 +129,10 @@ CHECKSUMS base64 (0.3.0) sha256=27337aeabad6ffae05c265c450490628ef3ebd4b67be58257393227588f5a97b bigdecimal (4.1.2) sha256=53d217666027eab4280346fba98e7d5b66baaae1b9c3c1c0ffe89d48188a3fbd bundler (4.0.18) sha256=02d9a17429de1847b4e0c9f27a9ee4b20c0a74c0a641b4e77195d6019e3618ac + domain_name (0.6.20260902) sha256=4fac7f8e0a77dc85ec02f6534fdeff38e143d434ab8a86528fe68ca5bc45a042 drb (2.2.3) sha256=0b00d6fdb50995fe4a45dea13663493c841112e4068656854646f418fda13373 faraday (2.14.3) sha256=1882247e6766615c8220b4392bf1d27f6ebb63d8e28267587cef1fb0bf37f278 + faraday-cookie_jar (0.0.8) sha256=0140605823f8cc63c7028fccee486aaed8e54835c360cffc1f7c8c07c4299dbb faraday-net_http (3.4.4) sha256=0e78af151747ed1b00f33e25973b4bc220d7f16c00c39676817c8b12331eb588 ffi (1.17.4-aarch64-linux-gnu) sha256=b208f06f91ffd8f5e1193da3cae3d2ccfc27fc36fba577baf698d26d91c080df ffi (1.17.4-aarch64-linux-musl) sha256=9286b7a615f2676245283aef0a0a3b475ae3aae2bb5448baace630bb77b91f39 @@ -136,6 +145,7 @@ CHECKSUMS ffi (1.17.4-x86_64-linux-gnu) sha256=9d3db14c2eae074b382fa9c083fe95aec6e0a1451da249eab096c34002bc752d ffi (1.17.4-x86_64-linux-musl) sha256=3fdf9888483de005f8ef8d1cf2d3b20d86626af206cbf780f6a6a12439a9c49e hashie (5.1.0) sha256=c266471896f323c446ea8207f8ffac985d2718df0a0ba98651a3057096ca3870 + http-cookie (1.1.6) sha256=ba4b82be64de61dc281243dac70e3c382c45142f20268ed9276a3670c93feaa9 json (2.21.2) sha256=1f1d3b7cf2b3ba1a69beca0bb6db13d5438b80bff3cd54cdaaa620b9b07c1c6a jwt (3.2.0) sha256=5419b1fe37b1da0982bd07051f573a8b8789ab724c2aa7e785e4784a3ed217d7 listen (3.10.0) sha256=c6e182db62143aeccc2e1960033bebe7445309c7272061979bb098d03760c9d2 diff --git a/data/plugins/.gitkeep b/data/plugins/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/docker-compose.yaml b/docker-compose.yaml index ee8d834..597fb7c 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -31,6 +31,13 @@ services: # Optional: blank disables the LiveTrack webhook endpoint rather than # failing to start, since it's not needed for the app's core function. LIVETRACK_WEBHOOK_SECRET: ${LIVETRACK_WEBHOOK_SECRET:-} + # Optional, only read by data/plugins/p4n2gpx/'s own p4n2gpx.rb (not + # part of this repo — see docs/deployment.adoc) if that private + # plugin is present; blank just means it fails with its own "could + # not authenticate" error when run, same non-fatal-to-startup story + # as the other optional secrets here. + P4N_USER: ${P4N_USER:-} + P4N_PASSWORD: ${P4N_PASSWORD:-} # The kiwix service below, reached by its compose service name (both # are on the same default compose network) — port matches its own # --port=8080 in the command below. Not made conditional on the ZIM