-
-
Notifications
You must be signed in to change notification settings - Fork 638
feat(chrome-extension): detect geospatial services #1967
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
fa47b10
a36f8ff
3cfc039
a650b7b
19a4e8c
2f31125
9700144
5cded1c
7f41770
388cb08
3cf3c51
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -5,6 +5,38 @@ export interface DataUrlParameter { | |||||||||||
| dataUrl: string; | ||||||||||||
| styleUrl: string | null; | ||||||||||||
| } | ||||||||||||
| const SERVICE_KINDS = new Set([ | ||||||||||||
| "xyz", | ||||||||||||
| "wms", | ||||||||||||
| "wmts", | ||||||||||||
| "wfs", | ||||||||||||
| "ogc-features", | ||||||||||||
| "ogc-vector-tiles", | ||||||||||||
| "arcgis", | ||||||||||||
| ]); | ||||||||||||
|
|
||||||||||||
| export interface ServiceUrlParameter { | ||||||||||||
| kind: string; | ||||||||||||
| url: string; | ||||||||||||
| /** The requested layer: WMS `LAYERS`, WFS `typeName`, a tile source layer. */ | ||||||||||||
| layer: string | null; | ||||||||||||
| /** A style document naming the source layers of a vector tileset. */ | ||||||||||||
| styleUrl: string | null; | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| export function serviceUrlParameter(search: string): ServiceUrlParameter | null { | ||||||||||||
| const params = new URLSearchParams(search); | ||||||||||||
| const kind = params.get("add"); | ||||||||||||
| const rawUrl = params.get("serviceUrl"); | ||||||||||||
| const url = httpUrl(rawUrl)?.replace(/%7B/gi, "{").replace(/%7D/gi, "}") ?? null; | ||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Consider scoping the placeholder restoration to only the kinds that need it:
Suggested change
(and use Confidence: medium — narrow real-world trigger, but a real correctness gap introduced by this PR.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in #1969 (landed after this PR merged) — brace restoration is now limited to xyz/wmts/ogc-vector-tiles, with a test asserting a WMS token keeps its encoded braces. |
||||||||||||
| if (!kind || !SERVICE_KINDS.has(kind) || !url) return null; | ||||||||||||
| return { | ||||||||||||
| kind, | ||||||||||||
| url, | ||||||||||||
| layer: params.get("serviceLayer")?.trim() || null, | ||||||||||||
| styleUrl: httpUrl(params.get("serviceStyle")), | ||||||||||||
| }; | ||||||||||||
| } | ||||||||||||
| export interface RemoteGeoJsonLayer { | ||||||||||||
| data: FeatureCollection; | ||||||||||||
| name: string; | ||||||||||||
|
|
||||||||||||
Uh oh!
There was an error while loading. Please reload this page.