extension: Allow this to work on Firefox when its eventually supported
This commit is contained in:
parent
10edaf2c48
commit
3a47f8a20f
|
@ -15,7 +15,9 @@ async function enable() {
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
action: {
|
action: {
|
||||||
type: chrome.declarativeNetRequest.RuleActionType.REDIRECT,
|
type:
|
||||||
|
chrome.declarativeNetRequest.RuleActionType?.REDIRECT ??
|
||||||
|
"redirect",
|
||||||
redirect: { regexSubstitution: playerPage + "#\\0" },
|
redirect: { regexSubstitution: playerPage + "#\\0" },
|
||||||
},
|
},
|
||||||
condition: {
|
condition: {
|
||||||
|
@ -32,14 +34,17 @@ async function enable() {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
resourceTypes: [
|
resourceTypes: [
|
||||||
chrome.declarativeNetRequest.ResourceType.MAIN_FRAME,
|
chrome.declarativeNetRequest.ResourceType?.MAIN_FRAME ??
|
||||||
|
"main_frame",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 2,
|
id: 2,
|
||||||
action: {
|
action: {
|
||||||
type: chrome.declarativeNetRequest.RuleActionType.REDIRECT,
|
type:
|
||||||
|
chrome.declarativeNetRequest.RuleActionType?.REDIRECT ??
|
||||||
|
"redirect",
|
||||||
redirect: { regexSubstitution: playerPage + "#\\0" },
|
redirect: { regexSubstitution: playerPage + "#\\0" },
|
||||||
},
|
},
|
||||||
condition: {
|
condition: {
|
||||||
|
@ -55,29 +60,39 @@ async function enable() {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
resourceTypes: [
|
resourceTypes: [
|
||||||
chrome.declarativeNetRequest.ResourceType.MAIN_FRAME,
|
chrome.declarativeNetRequest.ResourceType?.MAIN_FRAME ??
|
||||||
|
"main_frame",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 3,
|
id: 3,
|
||||||
action: {
|
action: {
|
||||||
type: chrome.declarativeNetRequest.RuleActionType.REDIRECT,
|
type:
|
||||||
|
chrome.declarativeNetRequest.RuleActionType?.REDIRECT ??
|
||||||
|
"redirect",
|
||||||
redirect: { regexSubstitution: playerPage + "#\\0" },
|
redirect: { regexSubstitution: playerPage + "#\\0" },
|
||||||
},
|
},
|
||||||
condition: {
|
condition: {
|
||||||
regexFilter: "^.*\\.s(?:wf|pl)(\\?.*|#.*|)$",
|
regexFilter: "^.*\\.s(?:wf|pl)(\\?.*|#.*|)$",
|
||||||
excludedResponseHeaders: [{ header: "content-type" }],
|
excludedResponseHeaders: [{ header: "content-type" }],
|
||||||
resourceTypes: [
|
resourceTypes: [
|
||||||
chrome.declarativeNetRequest.ResourceType.MAIN_FRAME,
|
chrome.declarativeNetRequest.ResourceType?.MAIN_FRAME ??
|
||||||
|
"main_frame",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
try {
|
||||||
await utils.declarativeNetRequest.updateDynamicRules({
|
await utils.declarativeNetRequest.updateDynamicRules({
|
||||||
removeRuleIds: [1, 2, 3],
|
removeRuleIds: [1, 2, 3],
|
||||||
addRules: rules,
|
addRules: rules,
|
||||||
});
|
});
|
||||||
|
} catch (e) {
|
||||||
|
console.info(
|
||||||
|
"Failed to register rules: responseHeaders condition unsupported",
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
!utils.scripting ||
|
!utils.scripting ||
|
||||||
|
|
Loading…
Reference in New Issue