Commit 6299590
authored
feat(chrome-extension): detect geospatial services (#1967)
* feat(chrome-extension): detect geospatial services
* fix(chrome-extension): hand services to add data
* fix(chrome-extension): scope detected services to pages
* fix(chrome-extension): harden service lifecycle
* fix(chrome-extension): detect services in embedded maps
* fix(chrome-extension): show services on raw responses
* fix(chrome-extension): make detected services addable
Service detection never stored anything in a real browser. The page scope
seeded a tab's document set from the main_frame request's documentId, but
Chrome sets no documentId on a navigation request: the document does not
exist yet. The set stayed empty, every later request was rejected, and the
earlier page-scoping, embedded-map and raw-response fixes were all inert.
Scope by retiring the previous page's documents instead, which needs no id
on the navigation itself and so covers raw responses and iframes too.
A detected endpoint was also not enough to add a layer. Each result now
carries the layer the page asked for, passed as serviceLayer/serviceStyle
and prefilled into the matching form field:
- WMS LAYERS and WFS typeName, with WFS operation parameters stripped from
the endpoint rather than left on it
- a WMTS GetTile request rewritten into the tile template that produced it
- the ArcGIS layer index, which a bare FeatureServer URL loses: GeoLibre
then falls back to the service's first layer and draws the wrong one
- the style document a vector tileset needs, since its source layers live
in the style and not in the tile URL
Results are listed per layer, as one endpoint can serve many. Two false
positives are gone as well: a style's glyph ranges are no longer offered as
a tile service, and a documentation link whose wording mentions a format is
no longer read as a dataset.
Verified end to end against live WMS, WMTS, WFS, OGC API Features, ArcGIS,
XYZ and vector tile sites: each adds a layer that draws, with no typing.
* Address Claude and CodeRabbit review feedback
- Draw the page boundary when a navigation starts rather than when it
completes. A tile or service request made by the incoming page can finish
before that page's own HTML does, and retiring documents at completion
swept up the new page's document along with the outgoing one's, rejecting
everything it went on to request.
- Require an OGC format parameter before treating a bare /collections as an
OGC API service. The path is an ordinary REST and storefront route as well,
so on its own it put unrelated services in the popup. /collections/<id>/items
is specific enough to stand alone and is unchanged.
- Tell a selection holding one service and one file apart from a selection
holding two services, which shared a message that only described the latter.
- Filter the deep-link source kind through masHidesDataSource, as every other
path that opens the Add Data dialog from outside the component already does.
Inert today, since no service kind is MAS-hidden.
- Point the README's CORS note at the service being fetched rather than at a
static file, which described the wrong failure mode for a detected service.
* Address Claude review feedback
- Skip the storage read for a candidate already at the head of a tab's list.
Panning a slippy map resolves nearly every tile to the same candidate, and
the dedup check only fired after the read it was meant to avoid.
- Fill in a vector tileset's style when the style document completes after the
tiles it describes. Either request can finish first, and an entry recorded
without a style leaves Add Data with no source layers to resolve.
- Narrow the page test in the document scanner. Any trailing slash counted as
a page, which silently dropped hint-based detection for REST endpoints that
conventionally end in one; a directory-style URL now counts as a page only
when the link text reads its slug back, which is what the documentation
links that motivated the rule look like.
- Cover both watcher behaviors with a test that drives background.mjs through
a stub of the extension APIs, which nothing exercised before.
* Address Claude review feedback
- Ignore the WMS and WFS form caches when a deep link supplies the endpoint.
A link whose service was detected without a layer (a GetCapabilities hit,
say) paired its fresh endpoint with the layer or feature type left over from
whichever service the dialog was last used for, which submits a request the
new service cannot answer. The WMS style is cleared with the layer for the
same reason.
- Keep a document marked for retirement when a straggling request from the
outgoing page completes mid-navigation. It was moved back among the incoming
page's documents and so outlived the navigation it should not have survived.1 parent d79c87d commit 6299590
24 files changed
Lines changed: 1186 additions & 71 deletions
File tree
- apps/geolibre-desktop/src
- components/layout
- add-data/sources
- hooks
- lib
- extensions/geolibre-chrome
- scripts
- tests
Lines changed: 37 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
47 | 57 | | |
48 | 58 | | |
49 | 59 | | |
| |||
55 | 65 | | |
56 | 66 | | |
57 | 67 | | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
58 | 71 | | |
59 | 72 | | |
60 | 73 | | |
61 | | - | |
| 74 | + | |
62 | 75 | | |
63 | | - | |
| 76 | + | |
64 | 77 | | |
65 | | - | |
| 78 | + | |
66 | 79 | | |
67 | | - | |
| 80 | + | |
68 | 81 | | |
69 | | - | |
| 82 | + | |
70 | 83 | | |
71 | | - | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
72 | 91 | | |
73 | 92 | | |
74 | 93 | | |
| |||
84 | 103 | | |
85 | 104 | | |
86 | 105 | | |
87 | | - | |
| 106 | + | |
88 | 107 | | |
89 | 108 | | |
90 | 109 | | |
| |||
107 | 126 | | |
108 | 127 | | |
109 | 128 | | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
110 | 132 | | |
111 | 133 | | |
112 | 134 | | |
| |||
158 | 180 | | |
159 | 181 | | |
160 | 182 | | |
161 | | - | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
162 | 191 | | |
163 | 192 | | |
164 | 193 | | |
| |||
Lines changed: 19 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
| 117 | + | |
117 | 118 | | |
118 | 119 | | |
119 | 120 | | |
| |||
1030 | 1031 | | |
1031 | 1032 | | |
1032 | 1033 | | |
1033 | | - | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
1034 | 1044 | | |
1035 | 1045 | | |
1036 | 1046 | | |
| |||
2086 | 2096 | | |
2087 | 2097 | | |
2088 | 2098 | | |
| 2099 | + | |
| 2100 | + | |
| 2101 | + | |
| 2102 | + | |
| 2103 | + | |
| 2104 | + | |
| 2105 | + | |
2089 | 2106 | | |
2090 | 2107 | | |
2091 | 2108 | | |
| |||
2098 | 2115 | | |
2099 | 2116 | | |
2100 | 2117 | | |
| 2118 | + | |
2101 | 2119 | | |
2102 | 2120 | | |
2103 | 2121 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| |||
Lines changed: 8 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
50 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
51 | 55 | | |
52 | 56 | | |
53 | 57 | | |
54 | 58 | | |
55 | 59 | | |
56 | 60 | | |
57 | | - | |
| 61 | + | |
58 | 62 | | |
59 | 63 | | |
60 | 64 | | |
| |||
Lines changed: 12 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
22 | 30 | | |
23 | 31 | | |
24 | | - | |
25 | | - | |
26 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
27 | 35 | | |
28 | 36 | | |
29 | 37 | | |
| |||
Lines changed: 13 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
35 | 41 | | |
36 | 42 | | |
37 | | - | |
38 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
39 | 48 | | |
40 | 49 | | |
41 | 50 | | |
42 | 51 | | |
43 | 52 | | |
44 | 53 | | |
45 | 54 | | |
46 | | - | |
| 55 | + | |
47 | 56 | | |
48 | 57 | | |
49 | 58 | | |
| |||
Lines changed: 19 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
42 | 48 | | |
43 | 49 | | |
44 | | - | |
45 | | - | |
46 | | - | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
47 | 59 | | |
48 | 60 | | |
49 | 61 | | |
50 | | - | |
| 62 | + | |
51 | 63 | | |
52 | 64 | | |
53 | 65 | | |
54 | 66 | | |
55 | 67 | | |
56 | | - | |
| 68 | + | |
57 | 69 | | |
58 | 70 | | |
59 | 71 | | |
60 | 72 | | |
61 | 73 | | |
62 | | - | |
| 74 | + | |
63 | 75 | | |
64 | 76 | | |
65 | 77 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| |||
0 commit comments