cube
cube copied to clipboard
May you please migrate it to manifest version 3?
Looking at Chrome's developer documentation:
[!NOTE] As of Manifest V3, the
webRequestBlocking
permission is no longer available for most extensions. ConsiderdeclarativeNetRequest
, which enables use of the declarativeNetRequest API. Aside fromwebRequestBlocking
, thewebRequest
API will be unchanged and available for normal use. Policy installed extensions can continue to usewebRequestBlocking
.
The
declarativeNetRequest
API is used to block or modify network requests by specifying declarative rules. This lets extensions modify network requests without intercepting them and viewing their content, thus providing more privacy. https://developer.chrome.com/docs/extensions/reference/api/declarativeNetRequest
It looks like the manifest.json
would look something like:
{
"manifest_version": 3,
...,
"permissions": [
"declarativeNetRequest",
"declarativeNetRequestFeedback"
],
"host_permissions": [
"<all_urls>"
],
...,
"declarative_net_request": {
"rule_resources": [{
"id": "ruleset_1",
"enabled": true,
"path": "rules.json"
}]
}
}
And the rules.json
file would look something like:
[
{
"id": 1,
"priority": 1,
"action": { "type": "block" },
"condition": { "urlFilter": "example.com", "resourceTypes": ["main_frame"] }
},
{
"id": 2,
"priority": 1,
"action": { "type": "block" },
"condition": { "urlFilter": "anotherexample.com", "resourceTypes": ["main_frame"] }
}
...
]
There's also the concept of "dynamic rules" to consider.