-
-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reduce hard minimum chrome version to 94 with a warning bar
- Loading branch information
Showing
7 changed files
with
77 additions
and
40 deletions.
There are no files selected for viewing
This file contains 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 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 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 |
---|---|---|
@@ -1,18 +1,37 @@ | ||
import {get_config} from "./config"; | ||
import Rule = chrome.declarativeNetRequest.Rule; | ||
|
||
export async function reset_dnr_status() { | ||
const RULE = { | ||
id: 1001, | ||
action: { | ||
type: 'block', | ||
}, | ||
condition: { | ||
requestDomains: [ | ||
'chat.bilibili.com' | ||
], | ||
excludedInitiatorDomains: [ | ||
'live.bilibili.com' | ||
], | ||
resourceTypes: [ | ||
'websocket' | ||
], | ||
}, | ||
} as Rule; | ||
|
||
export async function install_dnr_rule() { | ||
let config = await get_config(); | ||
let enabled = (await chrome.declarativeNetRequest.getDynamicRules()).some(r => r.id===RULE.id); | ||
|
||
// reset status of danmu-update-blocker | ||
if(config.BREAK_UPDATE) { | ||
await chrome.declarativeNetRequest.updateEnabledRulesets({ | ||
enableRulesetIds: ['danmu-update-blocker'], | ||
if(config.BREAK_UPDATE && !enabled) { | ||
await chrome.declarativeNetRequest.updateDynamicRules({ | ||
addRules: [RULE], | ||
}); | ||
console.log('pakku update blocker: enabled dnr ruleset'); | ||
} else { | ||
await chrome.declarativeNetRequest.updateEnabledRulesets({ | ||
disableRulesetIds: ['danmu-update-blocker'], | ||
console.log('pakku update blocker: add dnr ruleset'); | ||
} else if(!config.BREAK_UPDATE && enabled) { | ||
await chrome.declarativeNetRequest.updateDynamicRules({ | ||
removeRuleIds: [RULE.id], | ||
}); | ||
console.log('pakku update blocker: disabled dnr ruleset'); | ||
console.log('pakku update blocker: remove dnr ruleset'); | ||
} | ||
} |
This file contains 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 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 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 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