Add an import plugin system, with the Overpass POI query as its first plugin
A plugin is a directory under plugins/ with a plugin.json manifest
({"label": "...", "command": "./run.sh"}) plus a script that reads
--south/--west/--north/--east and prints a GeoJSON FeatureCollection
to stdout (lib/maptool/plugins.rb) — that's the entire interface a
plugin needs to know about this app. The sidebar's new import icon
(logged in only, GET /api/plugins + POST /api/plugins/:name/run) lists
whatever's found and runs one for the current map viewport, saving its
output as a new .geojson file the same way an upload would be.
The point: a scraper for a site whose ToS forbids that (Park4Night,
iOverlander, Freecampsites) doesn't need to live in this public repo
to work here — its own directory just goes under plugins/ locally and
is never git add'ed, no special-casing needed anywhere.
plugins/overpass-pois wraps the existing rake overpass:pois query as
the first, in-repo, reference example of the contract.
Also fills in four modules (auth.js, locate.js, measure.js, notes.js)
missing from layout.erb's cache-busting importmap alongside adding
plugins.js's own entry — a pre-existing gap that meant they could keep
serving a stale cached copy across a deploy despite the importmap
existing specifically to prevent that.
This commit is contained in:
1 parent
2b49eda7cb
commit
72ffd0ef18
17 files changed
+434
-14
No files matched your search
@@ -1439,3 +1439,60 @@ html, body {
|
||||
.profile-panel__tooltip-label {
|
||||
color: #c3c2b7;
|
||||
}
|
||||
|
||||
.plugins-panel__hint {
|
||||
margin: 0 0 6px;
|
||||
max-width: 200px;
|
||||
color: #888;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.plugins-panel__list {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.plugins-panel__item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 4px 0;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.plugins-panel__label {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.plugins-panel__run {
|
||||
/* See .notes-panel__actions button's own comment — without this some
|
||||
browsers paint their own hover/active highlight over a custom
|
||||
background. */
|
||||
appearance: none;
|
||||
padding: 4px 10px;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
background: #1a5fb4;
|
||||
color: #fff;
|
||||
font: inherit;
|
||||
font-size: 12px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.plugins-panel__run:disabled {
|
||||
opacity: 0.6;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.plugins-panel__status {
|
||||
min-width: 3.5em;
|
||||
color: #888;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.plugins-panel__empty {
|
||||
color: #888;
|
||||
white-space: normal;
|
||||
max-width: 200px;
|
||||
}
|
||||
Reference in new issue
Block a user