1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-22 02:12:44 +01:00

Use uBO's default listset

This commit is contained in:
Raymond Hill 2024-10-11 09:03:30 -04:00
parent 01eebffc1f
commit caba9cdefa
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -36,6 +36,17 @@ import { StaticNetFilteringEngine } from '@gorhill/ubo-core';
/******************************************************************************/ /******************************************************************************/
async function fetchList(name, url) {
return fetch(url).then(r => {
return r.text();
}).then(raw => {
console.log(`${name} fetched`);
return { name, raw };
}).catch(reason => {
console.error(reason);
});
}
async function main() { async function main() {
const pathToSelfie = 'cache/selfie.txt'; const pathToSelfie = 'cache/selfie.txt';
@ -62,24 +73,14 @@ async function main() {
if ( !selfie ) { if ( !selfie ) {
console.log(`Fetching lists...`); console.log(`Fetching lists...`);
await snfe.useLists([ await snfe.useLists([
fetch('https://easylist.to/easylist/easylist.txt') fetchList('ubo-ads', 'https://ublockorigin.github.io/uAssetsCDN/filters/filters.min.txt'),
.then(r => { fetchList('ubo-badware', 'https://ublockorigin.github.io/uAssetsCDN/filters/badware.min.txt'),
return r.text(); fetchList('ubo-privacy', 'https://ublockorigin.github.io/uAssetsCDN/filters/privacy.min.txt'),
}).then(raw => { fetchList('ubo-unbreak', 'https://ublockorigin.github.io/uAssetsCDN/filters/unbreak.min.txt'),
console.log(`easylist fetched`); fetchList('ubo-quick', 'https://ublockorigin.github.io/uAssetsCDN/filters/quick-fixes.min.txt'),
return { name: 'easylist', raw }; fetchList('easylist', 'https://easylist.to/easylist/easylist.txt'),
}).catch(reason => { fetchList('easyprivacy', 'https://easylist.to/easylist/easyprivacy.txt'),
console.error(reason); fetchList('plowe', 'https://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=1&mimetype=plaintext'),
}),
fetch('https://easylist.to/easylist/easyprivacy.txt')
.then(r => {
return r.text();
}).then(raw => {
console.log(`easyprivacy fetched`);
return { name: 'easyprivacy', raw };
}).catch(reason => {
console.error(reason);
}),
]); ]);
const selfie = await snfe.serialize(); const selfie = await snfe.serialize();
await fs.mkdir('cache', { recursive: true }); await fs.mkdir('cache', { recursive: true });