-
-
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
Merged
Merged
Changes from 3 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
fa47b10
feat(chrome-extension): detect geospatial services
giswqs a36f8ff
fix(chrome-extension): hand services to add data
giswqs 3cfc039
fix(chrome-extension): scope detected services to pages
giswqs a650b7b
fix(chrome-extension): harden service lifecycle
giswqs 19a4e8c
fix(chrome-extension): detect services in embedded maps
giswqs 2f31125
fix(chrome-extension): show services on raw responses
giswqs 9700144
fix(chrome-extension): make detected services addable
giswqs 5cded1c
Address Claude and CodeRabbit review feedback
giswqs 7f41770
Address Claude review feedback
giswqs 388cb08
Address Claude review feedback
giswqs 3cf3c51
Address Claude review feedback
giswqs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| import { classifyServiceRequest, createTabTaskQueue } from "./service-scanner.mjs"; | ||
|
|
||
| const MAX_REQUESTS_PER_TAB = 100; | ||
| const enqueue = createTabTaskQueue(); | ||
| const removedTabs = new Set(); | ||
|
|
||
| chrome.webRequest.onCompleted.addListener( | ||
| ({ tabId, url, type }) => { | ||
| if (type === "main_frame" && tabId >= 0) { | ||
| removedTabs.delete(tabId); | ||
| void enqueue(tabId, () => chrome.storage.session.remove(`services:${tabId}`)); | ||
|
coderabbitai[bot] marked this conversation as resolved.
Outdated
|
||
| } | ||
| if (tabId < 0 || removedTabs.has(tabId)) return; | ||
| const service = classifyServiceRequest(url); | ||
| if (!service) return; | ||
| void enqueue(tabId, async () => { | ||
| if (removedTabs.has(tabId)) return; | ||
| const key = `services:${tabId}`; | ||
| const stored = await chrome.storage.session.get(key); | ||
| const existing = Array.isArray(stored[key]) ? stored[key] : []; | ||
| const next = [service, ...existing.filter((entry) => entry.url !== service.url)].slice( | ||
| 0, | ||
| MAX_REQUESTS_PER_TAB, | ||
| ); | ||
| await chrome.storage.session.set({ [key]: next }); | ||
| }); | ||
| }, | ||
| { urls: ["http://*/*", "https://*/*"] }, | ||
| ); | ||
|
giswqs marked this conversation as resolved.
|
||
|
|
||
| chrome.tabs.onRemoved.addListener((tabId) => { | ||
| removedTabs.add(tabId); | ||
| void enqueue(tabId, () => chrome.storage.session.remove(`services:${tabId}`)); | ||
| }); | ||
|
giswqs marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.