mirror of
https://github.com/gorhill/uBlock.git
synced 2026-03-11 09:04:36 +00:00
draft
This commit is contained in:
parent
635a6d9268
commit
1a49c7ad86
6 changed files with 15 additions and 15 deletions
|
|
@ -319,7 +319,7 @@ async function init() {
|
|||
|
||||
let url;
|
||||
try {
|
||||
const strictBlockURL = runtime.getURL('/strict-block.html');
|
||||
const strictBlockURL = runtime.getURL('/strictblock.');
|
||||
url = new URL(currentTab.url);
|
||||
if ( url.href.startsWith(strictBlockURL) ) {
|
||||
url = new URL(url.hash.slice(1));
|
||||
|
|
|
|||
|
|
@ -279,15 +279,15 @@ async function updateStrictBlockRules(dynamicRules, sessionRules) {
|
|||
// Fetch strick-block hostnames
|
||||
const toFetch = [];
|
||||
for ( const details of rulesetDetails ) {
|
||||
if ( details.rules.strictBlock === 0 ) { continue; }
|
||||
toFetch.push(fetchJSON(`/rulesets/strict-block/${details.id}`));
|
||||
if ( details.rules.strictblock === 0 ) { continue; }
|
||||
toFetch.push(fetchJSON(`/rulesets/strictblock/${details.id}`));
|
||||
}
|
||||
const strictBlockRulesets = await Promise.all(toFetch);
|
||||
const strictblockRulesets = await Promise.all(toFetch);
|
||||
|
||||
// Strict-block rules can only be enforced with omnipotence
|
||||
let toStrictBlock = new Set();
|
||||
if ( hasOmnipotence ) {
|
||||
for ( const hostnames of strictBlockRulesets ) {
|
||||
for ( const hostnames of strictblockRulesets ) {
|
||||
if ( Array.isArray(hostnames) === false ) { continue; }
|
||||
toStrictBlock = toStrictBlock.union(new Set(hostnames));
|
||||
}
|
||||
|
|
@ -309,7 +309,7 @@ async function updateStrictBlockRules(dynamicRules, sessionRules) {
|
|||
let strictblockPath = '';
|
||||
for ( const war of manifest.web_accessible_resources ) {
|
||||
if ( war.resources.length !== 1 ) { continue; }
|
||||
if ( war.resources[0].startsWith('/strict-block.') === false ) { continue; }
|
||||
if ( war.resources[0].startsWith('/strictblock.') === false ) { continue; }
|
||||
strictblockPath = runtime.getURL(war.resources[0]);
|
||||
break;
|
||||
}
|
||||
|
|
@ -333,7 +333,7 @@ async function updateStrictBlockRules(dynamicRules, sessionRules) {
|
|||
dynamicRule.condition.excludedRequestDomains = permanentlyExcluded;
|
||||
}
|
||||
dynamicRules.push(dynamicRule);
|
||||
ubolLog(`Add 1 DNR dynamic rule with ${toStrictBlock.size} strict-blocked domains`);
|
||||
ubolLog(`Add 1 DNR dynamic rule with ${toStrictBlock.size} strictblock domains`);
|
||||
|
||||
if ( temporarilyExcluded.length === 0 ) { return; }
|
||||
sessionRules.push({
|
||||
|
|
@ -347,7 +347,7 @@ async function updateStrictBlockRules(dynamicRules, sessionRules) {
|
|||
},
|
||||
priority: 29,
|
||||
});
|
||||
ubolLog(`Add 1 DNR session rule with ${temporarilyExcluded.length} unstrict-blocked domains`);
|
||||
ubolLog(`Add 1 DNR session rule with ${temporarilyExcluded.length} excluded strictblock domains`);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
|
|
|||
|
|
@ -455,7 +455,7 @@ async function processNetworkFilters(assetDetails, network) {
|
|||
}
|
||||
if ( strictBlocked.size !== 0 ) {
|
||||
writeFile(
|
||||
`${rulesetDir}/strict-block/${assetDetails.id}.json`,
|
||||
`${rulesetDir}/strictblock/${assetDetails.id}.json`,
|
||||
toJSONRuleset(Array.from(strictBlocked))
|
||||
);
|
||||
}
|
||||
|
|
@ -469,7 +469,7 @@ async function processNetworkFilters(assetDetails, network) {
|
|||
removeparam: removeparamsGood.length,
|
||||
redirect: redirects.length,
|
||||
modifyHeaders: modifyHeaders.length,
|
||||
strictBlock: strictBlocked.size,
|
||||
strictblock: strictBlocked.size,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -1113,7 +1113,7 @@ async function rulesetFromURLs(assetDetails) {
|
|||
removeparam: netStats.removeparam,
|
||||
redirect: netStats.redirect,
|
||||
modifyHeaders: netStats.modifyHeaders,
|
||||
strictBlock: netStats.strictBlock,
|
||||
strictblock: netStats.strictblock,
|
||||
discarded: netStats.discarded,
|
||||
rejected: netStats.rejected,
|
||||
},
|
||||
|
|
@ -1363,8 +1363,8 @@ async function main() {
|
|||
// Patch web_accessible_resources key
|
||||
manifest.web_accessible_resources = manifest.web_accessible_resources || [];
|
||||
// Strict-block-related resource
|
||||
const strictblockDocument = `strict-block.${secret}.html`;
|
||||
copyFile('./strict-block.html', `${outputDir}/${strictblockDocument}`);
|
||||
const strictblockDocument = `strictblock.${secret}.html`;
|
||||
copyFile('./strictblock.html', `${outputDir}/${strictblockDocument}`);
|
||||
manifest.web_accessible_resources.push({
|
||||
resources: [ `/${strictblockDocument}` ],
|
||||
matches: [ '<all_urls>' ],
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
<link rel="stylesheet" href="css/default.css">
|
||||
<link rel="stylesheet" href="css/common.css">
|
||||
<link rel="stylesheet" href="css/fa-icons.css">
|
||||
<link rel="stylesheet" href="css/strict-block.css">
|
||||
<link rel="stylesheet" href="css/strictblock.css">
|
||||
<link rel="shortcut icon" type="image/png" href="img/icon_64.png"/>
|
||||
</head>
|
||||
<body>
|
||||
|
|
@ -38,6 +38,6 @@
|
|||
<script src="js/theme.js" type="module"></script>
|
||||
<script src="js/fa-icons.js" type="module"></script>
|
||||
<script src="js/i18n.js" type="module"></script>
|
||||
<script src="js/strict-block.js" type="module"></script>
|
||||
<script src="js/strictblock.js" type="module"></script>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Reference in a new issue