Skip to content
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

[FEATURE] Only inject content_scripts on specifically supported sites #241

Open
0xdevalias opened this issue Feb 2, 2025 · 3 comments
Open
Assignees
Labels
duplicate This issue or pull request already exists wontfix This will not be worked on

Comments

@0xdevalias
Copy link
Contributor

Is your feature request related to a problem? Please describe.

When browsing random sites, I sometimes notice errors/warnings from this extension in the DevTools console. I wouldn't have expected it to try and run on all sites.

Looking at the manifest, it appears as though it injects its content scripts into all sites:

"content_scripts": [
{
"matches": [
"*://*/*",
"file://*/*"
],
"js": [
"content/js/jquery.min.js",
"content/js/browser-polyfill.min.js",
"content/js/core.js",
"content/js/sonarr_radarr_lidarr_autosearch.js"
],
"run_at": "document_end"
}
],

Describe the solution you'd like

Ideally it would only inject into the specific sites that it supports monitoring, which I assume are these:

"host_permissions": [
"*://*.imdb.com/*",
"*://*.themoviedb.org/*",
"*://*.thetvdb.com/*",
"*://*.trakt.tv/*",
"*://*.tvmaze.com/*",
"*://*.musicbrainz.org/*",
"*://*.letterboxd.com/*",
"*://*.pogdesign.co.uk/*",
"*://*.rottentomatoes.com/*",
"*://*.metacritic.com/*",
"*://*.simkl.com/*",
"*://*.iptorrents*",
"*://*.last.fm/*",
"*://*.allocine.fr/*",
"*://*.myanimelist.net/*",
"*://*.betaseries.com/*",
"*://*.primevideo.com/*",
"<all_urls>"
]

And then ideally would also take into account which are enabled (or not) on this settings page:

Image

@0xdevalias 0xdevalias added the enhancement New feature or request label Feb 2, 2025
@0xdevalias 0xdevalias changed the title [FEATURE] Only inject userscripts on specifically supported sites [FEATURE] Only inject content_scripts on specifically supported sites Feb 2, 2025
@trossr32 trossr32 added duplicate This issue or pull request already exists wontfix This will not be worked on and removed enhancement New feature or request labels Feb 2, 2025
@trossr32
Copy link
Owner

trossr32 commented Feb 2, 2025

This was already raised in #145 and isn't possible; see: #145 (comment)

@trossr32 trossr32 closed this as completed Feb 2, 2025
@0xdevalias
Copy link
Contributor Author

This was already raised in #145 and isn't possible; see: #145 (comment)

FYI This change is being reverted in v2.8.1. All URLs permission is required because the extension performs the automated search on servarr instances, and this has broken since the release of v2.8.0.

There's no way to know what the URL of anyone's servarr instance would be, so URL limiting is just not possible.

Originally posted by @trossr32 in #145

@trossr32 I'm not sure about in Firefox/etc, but within Chrome, would the chrome.permissions API allow for this?

This part specifically looks relevant, and makes me think it should be possible:

If you want to request hosts that you only discover at runtime, include "https://*/*" in your extension's optional_host_permissions field. This lets you specify any origin in "Permissions.origins" as long as it has a matching scheme.

@0xdevalias
Copy link
Contributor Author

@trossr32 Any chance of re-opening this issue based on the above? Since it sounds like it is possible to support now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants