1
0
mirror of https://github.com/gorhill/uBlock.git synced 2025-01-31 12:11:36 +01:00

Experimental Safari version of uBOL

Still unclear whether this is possible, many glitches and
quirks requiring investigation.
This commit is contained in:
Raymond Hill 2025-01-07 12:15:23 -05:00
parent 2266473336
commit b8c363e780
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
19 changed files with 1694 additions and 260 deletions

View File

@ -1,30 +0,0 @@
env:
browser: true
es2022: true
extends: eslint:recommended
parserOptions:
sourceType: module
rules:
eqeqeq:
- warn
- always
indent:
- error
- 4
- ignoredNodes:
- Program > BlockStatement
- Program > ExpressionStatement > CallExpression > ArrowFunctionExpression > BlockStatement
- Program > ExpressionStatement > CallExpression > FunctionExpression > BlockStatement
- Program > IfStatement > BlockStatement
- Program > VariableDeclaration > VariableDeclarator > CallExpression > ArrowFunctionExpression > BlockStatement
- CallExpression > MemberExpression
- ArrayExpression > *
- ObjectExpression > *
no-control-regex: off
no-empty: off
sort-imports: warn
strict: warn
globals:
browser: readonly
chrome: readonly
vAPI: readonly

View File

@ -2,7 +2,7 @@
run_options := $(filter-out $@,$(MAKECMDGOALS)) run_options := $(filter-out $@,$(MAKECMDGOALS))
.PHONY: all clean cleanassets test lint chromium opera firefox npm dig \ .PHONY: all clean cleanassets test lint chromium opera firefox npm dig \
mv3 mv3-quick mv3-chromium mv3-firefox \ mv3 mv3-quick mv3-chromium mv3-firefox mv3-safari \
compare maxcost medcost mincost modifiers record wasm compare maxcost medcost mincost modifiers record wasm
sources := $(wildcard assets/* assets/*/* dist/version src/* src/*/* src/*/*/* src/*/*/*/*) sources := $(wildcard assets/* assets/*/* dist/version src/* src/*/* src/*/*/* src/*/*/*/*)
@ -33,10 +33,11 @@ dist/build/uBlock0.npm: tools/make-nodejs.sh $(sources) $(platform) $(assets)
tools/make-npm.sh tools/make-npm.sh
# Build the Node.js package. # Build the Node.js package.
npm: dist/build/uBlock0.npm npm: node_modules/
npm install
lint: npm lint: npm
cd dist/build/uBlock0.npm && npm run lint npm run lint
test: npm test: npm
cd dist/build/uBlock0.npm && npm run test cd dist/build/uBlock0.npm && npm run test
@ -66,6 +67,11 @@ dist/build/uBOLite.firefox: tools/make-mv3.sh $(sources) $(platform)
mv3-firefox: dist/build/uBOLite.firefox mv3-firefox: dist/build/uBOLite.firefox
dist/build/uBOLite.safari: tools/make-mv3.sh $(sources) $(platform)
tools/make-mv3.sh safari
mv3-safari: dist/build/uBOLite.safari
mv3-quick: tools/make-mv3.sh $(sources) $(platform) mv3-quick: tools/make-mv3.sh $(sources) $(platform)
tools/make-mv3.sh quick tools/make-mv3.sh quick

47
eslint.config.mjs Normal file
View File

@ -0,0 +1,47 @@
import js from "@eslint/js";
import globals from "globals";
import json from "@eslint/json";
export default [ {
files: ["**/*.js", "**/*.mjs"],
...js.configs.recommended,
}, {
files: ["**/*.js", "**/*.mjs"],
languageOptions: {
globals: {
...globals.browser,
browser: "readonly",
chrome: "readonly",
vAPI: "readonly",
},
sourceType: "module",
},
rules: {
eqeqeq: ["warn", "always"],
indent: ["error", 4, {
ignoredNodes: [
"Program > BlockStatement",
"Program > ExpressionStatement > CallExpression > ArrowFunctionExpression > BlockStatement",
"Program > ExpressionStatement > CallExpression > FunctionExpression > BlockStatement",
"Program > IfStatement > BlockStatement",
"Program > VariableDeclaration > VariableDeclarator > CallExpression > ArrowFunctionExpression > BlockStatement",
"CallExpression > MemberExpression",
"ArrayExpression > *",
"ObjectExpression > *",
],
}],
"no-control-regex": "off",
"no-empty": "off",
"sort-imports": "warn",
strict: "warn",
},
}, {
files: ["**/*.mjs"],
languageOptions: { sourceType: 'module' },
}, {
files: ["**/*.json"],
ignores: ["package-lock.json"],
language: "json/json",
...json.configs.recommended,
} ];

1123
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

27
package.json Normal file
View File

@ -0,0 +1,27 @@
{
"name": "uBlock",
"version": "1.0.0",
"description": "npm dev tools",
"main": "index.js",
"scripts": {
"lint": "eslint src/js/*.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/gorhill/uBlock.git"
},
"author": "Raymond Hill",
"license": "GPLv3",
"bugs": {
"url": "https://github.com/gorhill/uBlock/issues"
},
"homepage": "https://github.com/gorhill/uBlock#readme",
"devDependencies": {
"@eslint/js": "^9.17.0",
"@eslint/json": "^0.9.0",
"eslint": "^9.17.0",
"eslint-formatter-compact": "^8.40.0",
"globals": "^15.14.0"
}
}

View File

@ -0,0 +1,25 @@
/*******************************************************************************
uBlock Origin Lite - a comprehensive, MV3-compliant content blocker
Copyright (C) 2022-present Raymond Hill
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see {http://www.gnu.org/licenses/}.
Home: https://github.com/gorhill/uBlock
*/
export const webext = self.chrome;
export const initiatorDomains = 'initiatorDomains';
export const excludedInitiatorDomains = 'excludedInitiatorDomains';

View File

@ -75,7 +75,7 @@ import { registerInjectables } from './scripting-manager.js';
/******************************************************************************/ /******************************************************************************/
const UBOL_ORIGIN = runtime.getURL('').replace(/\/$/, ''); const UBOL_ORIGIN = runtime.getURL('').replace(/\/$/, '').toLowerCase();
const canShowBlockedCount = typeof dnr.setExtensionActionOptions === 'function'; const canShowBlockedCount = typeof dnr.setExtensionActionOptions === 'function';
@ -176,7 +176,9 @@ function onMessage(request, sender, callback) {
// https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/MessageSender // https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/MessageSender
// Firefox API does not set `sender.origin` // Firefox API does not set `sender.origin`
if ( sender.origin !== undefined && sender.origin !== UBOL_ORIGIN ) { return; } if ( sender.origin !== undefined ) {
if ( sender.origin.toLowerCase() !== UBOL_ORIGIN ) { return; }
}
switch ( request.what ) { switch ( request.what ) {

View File

@ -19,11 +19,17 @@
Home: https://github.com/gorhill/uBlock Home: https://github.com/gorhill/uBlock
*/ */
import { dnr } from './ext.js'; import {
INITIATOR_DOMAINS,
dnr,
} from './ext.js';
/******************************************************************************/ /******************************************************************************/
export const isSideloaded = dnr.onRuleMatchedDebug instanceof Object; const isModern = dnr.onRuleMatchedDebug instanceof Object;
export const isSideloaded = isModern ||
typeof dnr.getMatchedRules === 'function';
/******************************************************************************/ /******************************************************************************/
@ -67,8 +73,8 @@ const getRuleset = async rulesetId => {
if ( condition.requestDomains ) { if ( condition.requestDomains ) {
condition.requestDomains = pruneLongLists(condition.requestDomains); condition.requestDomains = pruneLongLists(condition.requestDomains);
} }
if ( condition.initiatorDomains ) { if ( condition[INITIATOR_DOMAINS] ) {
condition.initiatorDomains = pruneLongLists(condition.initiatorDomains); condition[INITIATOR_DOMAINS] = pruneLongLists(condition[INITIATOR_DOMAINS]);
} }
} }
const ruleId = rule.id; const ruleId = rule.id;
@ -92,20 +98,32 @@ export const getMatchedRules = (( ) => {
const noopFn = ( ) => Promise.resolve([]); const noopFn = ( ) => Promise.resolve([]);
if ( isSideloaded !== true ) { return noopFn; } if ( isSideloaded !== true ) { return noopFn; }
return async tabId => { if ( isModern ) {
const promises = []; return async tabId => {
for ( let i = 0; i < bufferSize; i++ ) { const promises = [];
const j = (writePtr + i) % bufferSize; for ( let i = 0; i < bufferSize; i++ ) {
const ruleInfo = matchedRules[j]; const j = (writePtr + i) % bufferSize;
if ( ruleInfo === null ) { continue; } const ruleInfo = matchedRules[j];
if ( ruleInfo.request.tabId !== -1 ) { if ( ruleInfo === null ) { continue; }
if ( ruleInfo.request.tabId !== tabId ) { continue; } if ( ruleInfo.request.tabId !== -1 ) {
if ( ruleInfo.request.tabId !== tabId ) { continue; }
}
const promise = getRuleDetails(ruleInfo);
if ( promise === undefined ) { continue; }
promises.unshift(promise);
} }
const promise = getRuleDetails(ruleInfo); return Promise.all(promises);
if ( promise === undefined ) { continue; } };
promises.unshift(promise); }
return async tabId => {
const matchedRules = await dnr.getMatchedRules({ tabId });
if ( matchedRules instanceof Object === false ) { return []; }
const out = [];
for ( const ruleInfo of matchedRules.rulesMatchedInfo ) {
out.push({ request: ruleInfo.request });
} }
return Promise.all(promises); return out;
}; };
})(); })();
@ -118,6 +136,7 @@ const matchedRuleListener = ruleInfo => {
export const toggleDeveloperMode = state => { export const toggleDeveloperMode = state => {
if ( isSideloaded !== true ) { return; } if ( isSideloaded !== true ) { return; }
if ( isModern === false ) { return; }
if ( state ) { if ( state ) {
dnr.onRuleMatchedDebug.addListener(matchedRuleListener); dnr.onRuleMatchedDebug.addListener(matchedRuleListener);
} else { } else {

View File

@ -19,18 +19,24 @@
Home: https://github.com/gorhill/uBlock Home: https://github.com/gorhill/uBlock
*/ */
export const browser = import {
self.browser instanceof Object && excludedInitiatorDomains,
self.browser instanceof Element === false initiatorDomains,
? self.browser webext,
: self.chrome; } from './ext-compat.js';
/******************************************************************************/
export const browser = webext;
export const dnr = browser.declarativeNetRequest; export const dnr = browser.declarativeNetRequest;
export const i18n = browser.i18n; export const i18n = browser.i18n;
export const runtime = browser.runtime; export const runtime = browser.runtime;
export const TAB_ID_NONE = browser.tabs.TAB_ID_NONE; export const TAB_ID_NONE = browser.tabs.TAB_ID_NONE;
export const windows = browser.windows; export const windows = browser.windows;
export const INITIATOR_DOMAINS = initiatorDomains;
export const EXCLUDED_INITIATOR_DOMAINS = excludedInitiatorDomains;
/******************************************************************************/ /******************************************************************************/
// The extension's service worker can be evicted at any time, so when we // The extension's service worker can be evicted at any time, so when we
@ -64,7 +70,7 @@ export async function localRead(key) {
const bin = await browser.storage.local.get(key); const bin = await browser.storage.local.get(key);
if ( bin instanceof Object === false ) { return; } if ( bin instanceof Object === false ) { return; }
return bin[key] ?? undefined; return bin[key] ?? undefined;
} catch(ex) { } catch {
} }
} }
@ -89,7 +95,7 @@ export async function sessionRead(key) {
const bin = await browser.storage.session.get(key); const bin = await browser.storage.session.get(key);
if ( bin instanceof Object === false ) { return; } if ( bin instanceof Object === false ) { return; }
return bin[key] ?? undefined; return bin[key] ?? undefined;
} catch(ex) { } catch {
} }
} }
@ -114,7 +120,7 @@ export async function adminRead(key) {
const bin = await browser.storage.managed.get(key); const bin = await browser.storage.managed.get(key);
if ( bin instanceof Object === false ) { return; } if ( bin instanceof Object === false ) { return; }
return bin[key] ?? undefined; return bin[key] ?? undefined;
} catch(ex) { } catch {
} }
} }

View File

@ -79,7 +79,7 @@ async function commitFilteringMode() {
granted = await browser.permissions.request({ granted = await browser.permissions.request({
origins: [ `*://*.${targetHostname}/*` ], origins: [ `*://*.${targetHostname}/*` ],
}); });
} catch(ex) { } catch {
} }
if ( granted !== true ) { if ( granted !== true ) {
setFilteringMode(beforeLevel); setFilteringMode(beforeLevel);
@ -287,7 +287,7 @@ dom.on('[data-i18n-title="popupTipReport"]', 'click', ev => {
let url; let url;
try { try {
url = new URL(currentTab.url); url = new URL(currentTab.url);
} catch(_) { } catch {
} }
if ( url === undefined ) { return; } if ( url === undefined ) { return; }
const reportURL = new URL(runtime.getURL('/report.html')); const reportURL = new URL(runtime.getURL('/report.html'));
@ -325,7 +325,8 @@ async function init() {
url = new URL(url.hash.slice(1)); url = new URL(url.hash.slice(1));
} }
tabURL.href = url.href || ''; tabURL.href = url.href || '';
} catch(ex) { } catch {
return false;
} }
if ( url !== undefined ) { if ( url !== undefined ) {
@ -391,11 +392,13 @@ async function init() {
} }
async function tryInit() { async function tryInit() {
let success = false;
try { try {
await init(); success = await init();
} catch(ex) { } catch {
setTimeout(tryInit, 100);
} }
if ( success ) { return; }
setTimeout(tryInit, 100);
} }
tryInit(); tryInit();

View File

@ -20,6 +20,8 @@
*/ */
import { import {
EXCLUDED_INITIATOR_DOMAINS,
INITIATOR_DOMAINS,
TAB_ID_NONE, TAB_ID_NONE,
browser, browser,
dnr, dnr,
@ -305,7 +307,7 @@ async function updateDynamicRules() {
]); ]);
if ( addRules.length === 0 && removeRuleIds.length === 0 ) { return; } if ( addRules.length === 0 && removeRuleIds.length === 0 ) { return; }
const maxRegexRuleCount = dnr.MAX_NUMBER_OF_REGEX_RULES; const maxRegexRuleCount = dnr.MAX_NUMBER_OF_REGEX_RULES || 1000;
let regexRuleCount = 0; let regexRuleCount = 0;
let ruleId = 1; let ruleId = 1;
for ( const rule of addRules ) { for ( const rule of addRules ) {
@ -527,10 +529,10 @@ async function filteringModesToDNR(modes) {
priority: 100, priority: 100,
}; };
if ( rule0.condition.requestDomains ) { if ( rule0.condition.requestDomains ) {
rule1.condition.initiatorDomains = rule1.condition[INITIATOR_DOMAINS] =
rule0.condition.requestDomains.slice(); rule0.condition.requestDomains.slice();
} else if ( rule0.condition.excludedRequestDomains ) { } else if ( rule0.condition.excludedRequestDomains ) {
rule1.condition.excludedInitiatorDomains = rule1.condition[EXCLUDED_INITIATOR_DOMAINS] =
rule0.condition.excludedRequestDomains.slice(); rule0.condition.excludedRequestDomains.slice();
} }
addSessionRules.push(rule1); addSessionRules.push(rule1);
@ -563,8 +565,8 @@ const isDifferentAllowRules = (a, b) => {
const pp = [ const pp = [
'requestDomains', 'requestDomains',
'excludedRequestDomains', 'excludedRequestDomains',
'initiatorDomains', INITIATOR_DOMAINS,
'excludedInitiatorDomains', EXCLUDED_INITIATOR_DOMAINS,
]; ];
for ( const p of pp ) { for ( const p of pp ) {
const ac = a?.length && a[0].condition[p] || []; const ac = a?.length && a[0].condition[p] || [];

View File

@ -103,9 +103,12 @@ async function onFilteringModeChange(ev) {
switch ( newLevel ) { switch ( newLevel ) {
case 1: { // Revoke broad permissions case 1: { // Revoke broad permissions
await browser.permissions.remove({ try {
origins: [ '<all_urls>' ] await browser.permissions.remove({ origins: [ '<all_urls>' ] });
}); } catch(reason) {
console.error(reason);
await sendMessage({ what: 'setDefaultFilteringMode', level: 1 });
}
cachedRulesetData.defaultFilteringMode = 1; cachedRulesetData.defaultFilteringMode = 1;
break; break;
} }
@ -195,7 +198,7 @@ function getStagedTrustedSites() {
return punycode.toASCII( return punycode.toASCII(
(new URL(`https://${hn}/`)).hostname (new URL(`https://${hn}/`)).hostname
); );
} catch(_) { } catch {
} }
return ''; return '';
}).filter(hn => hn !== ''); }).filter(hn => hn !== '');
@ -292,7 +295,7 @@ sendMessage({
renderFilterLists(cachedRulesetData); renderFilterLists(cachedRulesetData);
renderWidgets(); renderWidgets();
dom.cl.remove(dom.body, 'loading'); dom.cl.remove(dom.body, 'loading');
} catch(ex) { } catch {
} }
listen(); listen();
}).catch(reason => { }).catch(reason => {

View File

@ -0,0 +1,25 @@
/*******************************************************************************
uBlock Origin Lite - a comprehensive, MV3-compliant content blocker
Copyright (C) 2022-present Raymond Hill
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see {http://www.gnu.org/licenses/}.
Home: https://github.com/gorhill/uBlock
*/
export const webext = self.browser;
export const initiatorDomains = 'initiatorDomains';
export const excludedInitiatorDomains = 'excludedInitiatorDomains';

View File

@ -70,10 +70,6 @@ const env = [
'user_stylesheet', 'user_stylesheet',
]; ];
if ( platform !== 'firefox' ) {
env.push('native_css_has');
}
/******************************************************************************/ /******************************************************************************/
const jsonSetMapReplacer = (k, v) => { const jsonSetMapReplacer = (k, v) => {
@ -125,7 +121,7 @@ const fetchText = (url, cacheDir) => {
const content = data.join(''); const content = data.join('');
try { try {
writeFile(`${cacheDir}/${fname}`, content); writeFile(`${cacheDir}/${fname}`, content);
} catch (ex) { } catch {
} }
resolve({ url, content }); resolve({ url, content });
}); });
@ -303,6 +299,38 @@ const isURLSkip = rule =>
/******************************************************************************/ /******************************************************************************/
function patchRuleset(ruleset) {
if ( platform !== 'safari' ) { return ruleset; }
const out = [];
for ( const rule of ruleset ) {
const condition = rule.condition;
if ( rule.action.type === 'modifyHeaders' ) {
log(`Safari's incomplete API: ${JSON.stringify(rule)}`, true);
continue;
}
if ( Array.isArray(condition.requestMethods) ) {
log(`Safari's incomplete API: ${JSON.stringify(rule)}`, true);
continue;
}
if ( Array.isArray(condition.excludedRequestMethods) ) {
log(`Safari's incomplete API: ${JSON.stringify(rule)}`, true);
continue;
}
if ( Array.isArray(condition.initiatorDomains) ) {
condition.domains = condition.initiatorDomains;
delete condition.initiatorDomains;
}
if ( Array.isArray(condition.excludedInitiatorDomains) ) {
condition.excludedDomains = condition.excludedInitiatorDomains;
delete condition.excludedInitiatorDomains;
}
out.push(rule);
}
return out;
}
/******************************************************************************/
// Two distinct hostnames: // Two distinct hostnames:
// www.example.com // www.example.com
// example.com // example.com
@ -473,7 +501,9 @@ async function processNetworkFilters(assetDetails, network) {
} }
} }
const plainGood = rules.filter(rule => isSafe(rule) && isRegex(rule) === false); const plainGood = patchRuleset(
rules.filter(rule => isSafe(rule) && isRegex(rule) === false)
);
log(`\tPlain good: ${plainGood.length}`); log(`\tPlain good: ${plainGood.length}`);
log(plainGood log(plainGood
.filter(rule => Array.isArray(rule._warning)) .filter(rule => Array.isArray(rule._warning))
@ -481,12 +511,16 @@ async function processNetworkFilters(assetDetails, network) {
.join('\n'), true .join('\n'), true
); );
const regexes = rules.filter(rule => isSafe(rule) && isRegex(rule)); const regexes = patchRuleset(
rules.filter(rule => isSafe(rule) && isRegex(rule))
);
log(`\tMaybe good (regexes): ${regexes.length}`); log(`\tMaybe good (regexes): ${regexes.length}`);
const redirects = rules.filter(rule => const redirects = patchRuleset(
isUnsupported(rule) === false && rules.filter(rule =>
isRedirect(rule) isUnsupported(rule) === false &&
isRedirect(rule)
)
); );
redirects.forEach(rule => { redirects.forEach(rule => {
if ( rule.action.redirect.extensionPath === undefined ) { return; } if ( rule.action.redirect.extensionPath === undefined ) { return; }
@ -496,17 +530,23 @@ async function processNetworkFilters(assetDetails, network) {
}); });
log(`\tredirect=: ${redirects.length}`); log(`\tredirect=: ${redirects.length}`);
const removeparamsGood = rules.filter(rule => const removeparamsGood = patchRuleset(
isUnsupported(rule) === false && isRemoveparam(rule) rules.filter(rule =>
isUnsupported(rule) === false && isRemoveparam(rule)
)
); );
const removeparamsBad = rules.filter(rule => const removeparamsBad = patchRuleset(
isUnsupported(rule) && isRemoveparam(rule) rules.filter(rule =>
isUnsupported(rule) && isRemoveparam(rule)
)
); );
log(`\tremoveparams= (accepted/discarded): ${removeparamsGood.length}/${removeparamsBad.length}`); log(`\tremoveparams= (accepted/discarded): ${removeparamsGood.length}/${removeparamsBad.length}`);
const modifyHeaders = rules.filter(rule => const modifyHeaders = patchRuleset(
isUnsupported(rule) === false && rules.filter(rule =>
isModifyHeaders(rule) isUnsupported(rule) === false &&
isModifyHeaders(rule)
)
); );
log(`\tmodifyHeaders=: ${modifyHeaders.length}`); log(`\tmodifyHeaders=: ${modifyHeaders.length}`);

View File

@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<title>uBO Lite</title>
</head>
<body>
<script type="module" src="js/background.js"></script>
</body>
</html>

View File

@ -0,0 +1,56 @@
/*******************************************************************************
uBlock Origin Lite - a comprehensive, MV3-compliant content blocker
Copyright (C) 2022-present Raymond Hill
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see {http://www.gnu.org/licenses/}.
Home: https://github.com/gorhill/uBlock
*/
export const webext = self.browser;
export const initiatorDomains = 'domains';
export const excludedInitiatorDomains = 'excludedDomains';
const { declarativeNetRequest: dnr } = webext;
const { getDynamicRules, getSessionRules } = dnr;
// https://developer.mozilla.org/docs/Mozilla/Add-ons/WebExtensions/API/declarativeNetRequest/getDynamicRules
dnr.getDynamicRules = function({ ruleIds } = {}) {
return new Promise(resolve => {
getDynamicRules.call(dnr, rules => {
if ( Array.isArray(rules) === false ) { return resolve([]); }
if ( Array.isArray(ruleIds) === false ) { return resolve(rules); }
return resolve(rules.filter(rule => ruleIds.includes(rule.id)));
});
});
};
// https://developer.mozilla.org/docs/Mozilla/Add-ons/WebExtensions/API/declarativeNetRequest/getSessionRules
dnr.getSessionRules = function({ ruleIds } = {}) {
return new Promise(resolve => {
getSessionRules.call(dnr, rules => {
if ( Array.isArray(rules) === false ) { return resolve([]); }
if ( Array.isArray(ruleIds) === false ) { return resolve(rules); }
return resolve(rules.filter(rule => ruleIds.includes(rule.id)));
});
});
};
// https://developer.mozilla.org/docs/Mozilla/Add-ons/WebExtensions/API/declarativeNetRequest/getSessionRules
webext.declarativeNetRequest.getAvailableStaticRuleCount = async function() {
return 150000;
};

View File

@ -0,0 +1,50 @@
{
"action": {
"default_icon": "/img/icon_64.png",
"default_popup": "popup.html"
},
"author": "Raymond Hill",
"background": {
"scripts": [ "/js/background.js" ],
"type": "module"
},
"declarative_net_request": {
"rule_resources": [
]
},
"default_locale": "en",
"description": "__MSG_extShortDesc__",
"icons": {
"16": "/img/icon_16.png",
"32": "/img/icon_32.png",
"64": "/img/icon_64.png",
"128": "/img/icon_128.png",
"512": "/img/icon_512.png"
},
"manifest_version": 3,
"name": "__MSG_extName__",
"options_ui": {
"page": "dashboard.html"
},
"host_permissions": [
"<all_urls>"
],
"permissions": [
"activeTab",
"declarativeNetRequest",
"scripting",
"storage"
],
"short_name": "uBO Lite",
"version": "1.0",
"web_accessible_resources": [
{
"resources": [
"/strictblock.html"
],
"matches": [
"<all_urls>"
]
}
]
}

View File

@ -1,12 +1,12 @@
{ {
"name": "@gorhill/ubo-core", "name": "@gorhill/ubo-core",
"version": "0.1.26", "version": "0.1.30",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@gorhill/ubo-core", "name": "@gorhill/ubo-core",
"version": "0.1.26", "version": "0.1.30",
"license": "GPL-3.0-or-later", "license": "GPL-3.0-or-later",
"devDependencies": { "devDependencies": {
"c8": "^7.12.0", "c8": "^7.12.0",
@ -16,7 +16,7 @@
"scaling-palm-tree": "github:mjethani/scaling-palm-tree#15cf1ab37e038771e1ff8005edc46d95f176739f" "scaling-palm-tree": "github:mjethani/scaling-palm-tree#15cf1ab37e038771e1ff8005edc46d95f176739f"
}, },
"engines": { "engines": {
"node": ">=14.0.0", "node": ">=18.0.0",
"npm": ">=6.14.4" "npm": ">=6.14.4"
} }
}, },
@ -192,10 +192,14 @@
} }
}, },
"node_modules/ansi-colors": { "node_modules/ansi-colors": {
"version": "4.1.1", "version": "4.1.3",
"resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz",
"integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", "integrity": "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==",
"dev": true "dev": true,
"license": "MIT",
"engines": {
"node": ">=6"
}
}, },
"node_modules/ansi-regex": { "node_modules/ansi-regex": {
"version": "5.0.1", "version": "5.0.1",
@ -285,12 +289,6 @@
"node": ">=10.12.0" "node": ">=10.12.0"
} }
}, },
"node_modules/c8/node_modules/yargs-parser": {
"version": "20.2.9",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz",
"integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==",
"dev": true
},
"node_modules/callsites": { "node_modules/callsites": {
"version": "3.1.0", "version": "3.1.0",
"resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
@ -397,23 +395,28 @@
"dev": true "dev": true
}, },
"node_modules/cross-spawn": { "node_modules/cross-spawn": {
"version": "7.0.3", "version": "7.0.6",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
"integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==",
"dev": true, "dev": true,
"license": "MIT",
"dependencies": { "dependencies": {
"path-key": "^3.1.0", "path-key": "^3.1.0",
"shebang-command": "^2.0.0", "shebang-command": "^2.0.0",
"which": "^2.0.1" "which": "^2.0.1"
},
"engines": {
"node": ">= 8"
} }
}, },
"node_modules/debug": { "node_modules/debug": {
"version": "4.3.4", "version": "4.4.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz",
"integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==",
"dev": true, "dev": true,
"license": "MIT",
"dependencies": { "dependencies": {
"ms": "2.1.2" "ms": "^2.1.3"
}, },
"engines": { "engines": {
"node": ">=6.0" "node": ">=6.0"
@ -437,10 +440,14 @@
"dev": true "dev": true
}, },
"node_modules/diff": { "node_modules/diff": {
"version": "5.0.0", "version": "5.2.0",
"resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", "resolved": "https://registry.npmjs.org/diff/-/diff-5.2.0.tgz",
"integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", "integrity": "sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A==",
"dev": true "dev": true,
"license": "BSD-3-Clause",
"engines": {
"node": ">=0.3.1"
}
}, },
"node_modules/doctrine": { "node_modules/doctrine": {
"version": "3.0.0", "version": "3.0.0",
@ -1084,32 +1091,32 @@
} }
}, },
"node_modules/mocha": { "node_modules/mocha": {
"version": "10.2.0", "version": "10.8.2",
"resolved": "https://registry.npmjs.org/mocha/-/mocha-10.2.0.tgz", "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.8.2.tgz",
"integrity": "sha512-IDY7fl/BecMwFHzoqF2sg/SHHANeBoMMXFlS9r0OXKDssYE1M5O43wUY/9BVPeIvfH2zmEbBfseqN9gBQZzXkg==", "integrity": "sha512-VZlYo/WE8t1tstuRmqgeyBgCbJc/lEdopaa+axcKzTBJ+UIdlAB9XnmvTCAH4pwR4ElNInaedhEBmZD8iCSVEg==",
"dev": true, "dev": true,
"license": "MIT",
"dependencies": { "dependencies": {
"ansi-colors": "4.1.1", "ansi-colors": "^4.1.3",
"browser-stdout": "1.3.1", "browser-stdout": "^1.3.1",
"chokidar": "3.5.3", "chokidar": "^3.5.3",
"debug": "4.3.4", "debug": "^4.3.5",
"diff": "5.0.0", "diff": "^5.2.0",
"escape-string-regexp": "4.0.0", "escape-string-regexp": "^4.0.0",
"find-up": "5.0.0", "find-up": "^5.0.0",
"glob": "7.2.0", "glob": "^8.1.0",
"he": "1.2.0", "he": "^1.2.0",
"js-yaml": "4.1.0", "js-yaml": "^4.1.0",
"log-symbols": "4.1.0", "log-symbols": "^4.1.0",
"minimatch": "5.0.1", "minimatch": "^5.1.6",
"ms": "2.1.3", "ms": "^2.1.3",
"nanoid": "3.3.3", "serialize-javascript": "^6.0.2",
"serialize-javascript": "6.0.0", "strip-json-comments": "^3.1.1",
"strip-json-comments": "3.1.1", "supports-color": "^8.1.1",
"supports-color": "8.1.1", "workerpool": "^6.5.1",
"workerpool": "6.2.1", "yargs": "^16.2.0",
"yargs": "16.2.0", "yargs-parser": "^20.2.9",
"yargs-parser": "20.2.4", "yargs-unparser": "^2.0.0"
"yargs-unparser": "2.0.0"
}, },
"bin": { "bin": {
"_mocha": "bin/_mocha", "_mocha": "bin/_mocha",
@ -1117,10 +1124,6 @@
}, },
"engines": { "engines": {
"node": ">= 14.0.0" "node": ">= 14.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/mochajs"
} }
}, },
"node_modules/mocha/node_modules/brace-expansion": { "node_modules/mocha/node_modules/brace-expansion": {
@ -1128,10 +1131,32 @@
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
"integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
"dev": true, "dev": true,
"license": "MIT",
"dependencies": { "dependencies": {
"balanced-match": "^1.0.0" "balanced-match": "^1.0.0"
} }
}, },
"node_modules/mocha/node_modules/glob": {
"version": "8.1.0",
"resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz",
"integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==",
"deprecated": "Glob versions prior to v9 are no longer supported",
"dev": true,
"license": "ISC",
"dependencies": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "^5.0.1",
"once": "^1.3.0"
},
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/mocha/node_modules/has-flag": { "node_modules/mocha/node_modules/has-flag": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
@ -1139,10 +1164,11 @@
"dev": true "dev": true
}, },
"node_modules/mocha/node_modules/minimatch": { "node_modules/mocha/node_modules/minimatch": {
"version": "5.0.1", "version": "5.1.6",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz",
"integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==", "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==",
"dev": true, "dev": true,
"license": "ISC",
"dependencies": { "dependencies": {
"brace-expansion": "^2.0.1" "brace-expansion": "^2.0.1"
}, },
@ -1150,12 +1176,6 @@
"node": ">=10" "node": ">=10"
} }
}, },
"node_modules/mocha/node_modules/ms": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
"dev": true
},
"node_modules/mocha/node_modules/supports-color": { "node_modules/mocha/node_modules/supports-color": {
"version": "8.1.1", "version": "8.1.1",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz",
@ -1166,22 +1186,11 @@
} }
}, },
"node_modules/ms": { "node_modules/ms": {
"version": "2.1.2", "version": "2.1.3",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
"dev": true
},
"node_modules/nanoid": {
"version": "3.3.3",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.3.tgz",
"integrity": "sha512-p1sjXuopFs0xg+fPASzQ28agW1oHD7xDsd9Xkf3T15H3c/cifrFHVwrh74PdoklAPi+i7MdRsE47vm2r6JoB+w==",
"dev": true, "dev": true,
"bin": { "license": "MIT"
"nanoid": "bin/nanoid.cjs"
},
"engines": {
"node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
}
}, },
"node_modules/natural-compare": { "node_modules/natural-compare": {
"version": "1.4.0", "version": "1.4.0",
@ -1312,6 +1321,7 @@
"resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz",
"integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==",
"dev": true, "dev": true,
"license": "MIT",
"dependencies": { "dependencies": {
"safe-buffer": "^5.1.0" "safe-buffer": "^5.1.0"
} }
@ -1392,7 +1402,22 @@
"version": "5.2.1", "version": "5.2.1",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
"dev": true "dev": true,
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/feross"
},
{
"type": "patreon",
"url": "https://www.patreon.com/feross"
},
{
"type": "consulting",
"url": "https://feross.org/support"
}
],
"license": "MIT"
}, },
"node_modules/scaling-palm-tree": { "node_modules/scaling-palm-tree": {
"resolved": "git+ssh://git@github.com/mjethani/scaling-palm-tree.git#15cf1ab37e038771e1ff8005edc46d95f176739f", "resolved": "git+ssh://git@github.com/mjethani/scaling-palm-tree.git#15cf1ab37e038771e1ff8005edc46d95f176739f",
@ -1408,10 +1433,11 @@
} }
}, },
"node_modules/serialize-javascript": { "node_modules/serialize-javascript": {
"version": "6.0.0", "version": "6.0.2",
"resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz",
"integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==",
"dev": true, "dev": true,
"license": "BSD-3-Clause",
"dependencies": { "dependencies": {
"randombytes": "^2.1.0" "randombytes": "^2.1.0"
} }
@ -1558,10 +1584,11 @@
} }
}, },
"node_modules/workerpool": { "node_modules/workerpool": {
"version": "6.2.1", "version": "6.5.1",
"resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz", "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.5.1.tgz",
"integrity": "sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==", "integrity": "sha512-Fs4dNYcsdpYSAfVxhnl1L5zTksjvOJxtC5hzMNl+1t9B8hTJTdKDyZ5ju7ztgPy+ft9tBFXoOlDNiOT9WUXZlA==",
"dev": true "dev": true,
"license": "Apache-2.0"
}, },
"node_modules/wrap-ansi": { "node_modules/wrap-ansi": {
"version": "7.0.0", "version": "7.0.0",
@ -1626,10 +1653,14 @@
} }
}, },
"node_modules/yargs-parser": { "node_modules/yargs-parser": {
"version": "20.2.4", "version": "20.2.9",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz",
"integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==",
"dev": true "dev": true,
"license": "ISC",
"engines": {
"node": ">=10"
}
}, },
"node_modules/yargs-unparser": { "node_modules/yargs-unparser": {
"version": "2.0.0", "version": "2.0.0",
@ -1783,9 +1814,9 @@
} }
}, },
"ansi-colors": { "ansi-colors": {
"version": "4.1.1", "version": "4.1.3",
"resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz",
"integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", "integrity": "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==",
"dev": true "dev": true
}, },
"ansi-regex": { "ansi-regex": {
@ -1865,14 +1896,6 @@
"v8-to-istanbul": "^9.0.0", "v8-to-istanbul": "^9.0.0",
"yargs": "^16.2.0", "yargs": "^16.2.0",
"yargs-parser": "^20.2.9" "yargs-parser": "^20.2.9"
},
"dependencies": {
"yargs-parser": {
"version": "20.2.9",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz",
"integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==",
"dev": true
}
} }
}, },
"callsites": { "callsites": {
@ -1978,9 +2001,9 @@
"dev": true "dev": true
}, },
"cross-spawn": { "cross-spawn": {
"version": "7.0.3", "version": "7.0.6",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
"integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==",
"dev": true, "dev": true,
"requires": { "requires": {
"path-key": "^3.1.0", "path-key": "^3.1.0",
@ -1989,12 +2012,12 @@
} }
}, },
"debug": { "debug": {
"version": "4.3.4", "version": "4.4.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz",
"integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==",
"dev": true, "dev": true,
"requires": { "requires": {
"ms": "2.1.2" "ms": "^2.1.3"
} }
}, },
"decamelize": { "decamelize": {
@ -2010,9 +2033,9 @@
"dev": true "dev": true
}, },
"diff": { "diff": {
"version": "5.0.0", "version": "5.2.0",
"resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", "resolved": "https://registry.npmjs.org/diff/-/diff-5.2.0.tgz",
"integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", "integrity": "sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A==",
"dev": true "dev": true
}, },
"doctrine": { "doctrine": {
@ -2559,32 +2582,31 @@
} }
}, },
"mocha": { "mocha": {
"version": "10.2.0", "version": "10.8.2",
"resolved": "https://registry.npmjs.org/mocha/-/mocha-10.2.0.tgz", "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.8.2.tgz",
"integrity": "sha512-IDY7fl/BecMwFHzoqF2sg/SHHANeBoMMXFlS9r0OXKDssYE1M5O43wUY/9BVPeIvfH2zmEbBfseqN9gBQZzXkg==", "integrity": "sha512-VZlYo/WE8t1tstuRmqgeyBgCbJc/lEdopaa+axcKzTBJ+UIdlAB9XnmvTCAH4pwR4ElNInaedhEBmZD8iCSVEg==",
"dev": true, "dev": true,
"requires": { "requires": {
"ansi-colors": "4.1.1", "ansi-colors": "^4.1.3",
"browser-stdout": "1.3.1", "browser-stdout": "^1.3.1",
"chokidar": "3.5.3", "chokidar": "^3.5.3",
"debug": "4.3.4", "debug": "^4.3.5",
"diff": "5.0.0", "diff": "^5.2.0",
"escape-string-regexp": "4.0.0", "escape-string-regexp": "^4.0.0",
"find-up": "5.0.0", "find-up": "^5.0.0",
"glob": "7.2.0", "glob": "^8.1.0",
"he": "1.2.0", "he": "^1.2.0",
"js-yaml": "4.1.0", "js-yaml": "^4.1.0",
"log-symbols": "4.1.0", "log-symbols": "^4.1.0",
"minimatch": "5.0.1", "minimatch": "^5.1.6",
"ms": "2.1.3", "ms": "^2.1.3",
"nanoid": "3.3.3", "serialize-javascript": "^6.0.2",
"serialize-javascript": "6.0.0", "strip-json-comments": "^3.1.1",
"strip-json-comments": "3.1.1", "supports-color": "^8.1.1",
"supports-color": "8.1.1", "workerpool": "^6.5.1",
"workerpool": "6.2.1", "yargs": "^16.2.0",
"yargs": "16.2.0", "yargs-parser": "^20.2.9",
"yargs-parser": "20.2.4", "yargs-unparser": "^2.0.0"
"yargs-unparser": "2.0.0"
}, },
"dependencies": { "dependencies": {
"brace-expansion": { "brace-expansion": {
@ -2596,6 +2618,19 @@
"balanced-match": "^1.0.0" "balanced-match": "^1.0.0"
} }
}, },
"glob": {
"version": "8.1.0",
"resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz",
"integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==",
"dev": true,
"requires": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "^5.0.1",
"once": "^1.3.0"
}
},
"has-flag": { "has-flag": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
@ -2603,20 +2638,14 @@
"dev": true "dev": true
}, },
"minimatch": { "minimatch": {
"version": "5.0.1", "version": "5.1.6",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz",
"integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==", "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==",
"dev": true, "dev": true,
"requires": { "requires": {
"brace-expansion": "^2.0.1" "brace-expansion": "^2.0.1"
} }
}, },
"ms": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
"dev": true
},
"supports-color": { "supports-color": {
"version": "8.1.1", "version": "8.1.1",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz",
@ -2629,15 +2658,9 @@
} }
}, },
"ms": { "ms": {
"version": "2.1.2", "version": "2.1.3",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
"dev": true
},
"nanoid": {
"version": "3.3.3",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.3.tgz",
"integrity": "sha512-p1sjXuopFs0xg+fPASzQ28agW1oHD7xDsd9Xkf3T15H3c/cifrFHVwrh74PdoklAPi+i7MdRsE47vm2r6JoB+w==",
"dev": true "dev": true
}, },
"natural-compare": { "natural-compare": {
@ -2822,9 +2845,9 @@
"dev": true "dev": true
}, },
"serialize-javascript": { "serialize-javascript": {
"version": "6.0.0", "version": "6.0.2",
"resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz",
"integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==",
"dev": true, "dev": true,
"requires": { "requires": {
"randombytes": "^2.1.0" "randombytes": "^2.1.0"
@ -2954,9 +2977,9 @@
"dev": true "dev": true
}, },
"workerpool": { "workerpool": {
"version": "6.2.1", "version": "6.5.1",
"resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz", "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.5.1.tgz",
"integrity": "sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==", "integrity": "sha512-Fs4dNYcsdpYSAfVxhnl1L5zTksjvOJxtC5hzMNl+1t9B8hTJTdKDyZ5ju7ztgPy+ft9tBFXoOlDNiOT9WUXZlA==",
"dev": true "dev": true
}, },
"wrap-ansi": { "wrap-ansi": {
@ -3024,9 +3047,9 @@
} }
}, },
"yargs-parser": { "yargs-parser": {
"version": "20.2.4", "version": "20.2.9",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz",
"integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==",
"dev": true "dev": true
}, },
"yargs-unparser": { "yargs-unparser": {

View File

@ -23,6 +23,9 @@ for i in "$@"; do
chromium) chromium)
PLATFORM="chromium" PLATFORM="chromium"
;; ;;
safari)
PLATFORM="safari"
;;
uBOLite_+([0-9]).+([0-9]).+([0-9]).+([0-9])) uBOLite_+([0-9]).+([0-9]).+([0-9]).+([0-9]))
TAGNAME="$i" TAGNAME="$i"
FULL="yes" FULL="yes"
@ -84,13 +87,13 @@ cp -R "$UBO_DIR/src/img/flags-of-the-world" "$DES"/img
cp LICENSE.txt "$DES"/ cp LICENSE.txt "$DES"/
echo "*** uBOLite.mv3: Copying mv3-specific files" echo "*** uBOLite.mv3: Copying mv3-specific files"
if [ "$PLATFORM" = "firefox" ]; then cp platform/mv3/"$PLATFORM"/manifest.json "$DES"/
cp platform/mv3/firefox/background.html "$DES"/ cp platform/mv3/"$PLATFORM"/background.html "$DES"/ 2>/dev/null || :
fi
cp platform/mv3/extension/*.html "$DES"/ cp platform/mv3/extension/*.html "$DES"/
cp platform/mv3/extension/*.json "$DES"/ cp platform/mv3/extension/*.json "$DES"/
cp platform/mv3/extension/css/* "$DES"/css/ cp platform/mv3/extension/css/* "$DES"/css/
cp -R platform/mv3/extension/js/* "$DES"/js/ cp -R platform/mv3/extension/js/* "$DES"/js/
cp platform/mv3/"$PLATFORM"/ext-compat.js "$DES"/js/
cp platform/mv3/extension/img/* "$DES"/img/ cp platform/mv3/extension/img/* "$DES"/img/
cp -R platform/mv3/extension/_locales "$DES"/ cp -R platform/mv3/extension/_locales "$DES"/
cp platform/mv3/README.md "$DES/" cp platform/mv3/README.md "$DES/"
@ -99,11 +102,6 @@ if [ "$QUICK" != "yes" ]; then
echo "*** uBOLite.mv3: Generating rulesets" echo "*** uBOLite.mv3: Generating rulesets"
TMPDIR=$(mktemp -d) TMPDIR=$(mktemp -d)
mkdir -p "$TMPDIR" mkdir -p "$TMPDIR"
if [ "$PLATFORM" = "chromium" ]; then
cp platform/mv3/chromium/manifest.json "$DES"/
elif [ "$PLATFORM" = "firefox" ]; then
cp platform/mv3/firefox/manifest.json "$DES"/
fi
./tools/make-nodejs.sh "$TMPDIR" ./tools/make-nodejs.sh "$TMPDIR"
cp platform/mv3/package.json "$TMPDIR"/ cp platform/mv3/package.json "$TMPDIR"/
cp platform/mv3/*.js "$TMPDIR"/ cp platform/mv3/*.js "$TMPDIR"/