Chore: update build tools & data source

This commit is contained in:
SukkaW 2022-11-09 10:55:11 +08:00
parent 539b1a6eb8
commit cba717dade
3 changed files with 27 additions and 16 deletions

View File

@ -71,7 +71,7 @@ const BLACK_TLD = Array.from(new Set([
const results = [];
Object.entries(domainCountMap).forEach(([domain, count]) => {
if (
count >= 8
count >= 5
&& BLACK_TLD.some(tld => domain.endsWith(tld))
) {
results.push('.' + domain);
@ -79,5 +79,5 @@ const BLACK_TLD = Array.from(new Set([
});
const filePath = path.resolve(__dirname, '../List/domainset/reject_phishing.conf');
await fs.promises.writeFile(filePath, results.join('\n'), 'utf-8');
await fs.promises.writeFile(filePath, results.join('\n') + '\n', 'utf-8');
})();

View File

@ -38,20 +38,24 @@ const filterRuleWhitelistDomainSets = new Set(PREDEFINED_WHITELIST);
// Parse from AdGuard Filters
console.time('* Download and process AdBlock Filter Rules');
(await Promise.all(ADGUARD_FILTERS.map(input => {
if (typeof input === 'string') {
return processFilterRules(input);
}
if (Array.isArray(input) && input.length === 2) {
return processFilterRules(input[0], input[1]);
}
}))).forEach(({ white, black, foundDebugDomain }) => {
if (foundDebugDomain) {
process.exit(1);
};
white.forEach(i => filterRuleWhitelistDomainSets.add(i));
black.forEach(i => domainSets.add(i));
});
await Promise.all(ADGUARD_FILTERS.map(input => {
const promise = Array.isArray(input) && input.length === 2
? processFilterRules(input[0], input[1])
: processFilterRules(input);
return promise.then((i) => {
if (i) {
const { white, black, foundDebugDomain } = i;
if (foundDebugDomain) {
process.exit(1);
};
white.forEach(i => filterRuleWhitelistDomainSets.add(i));
black.forEach(i => domainSets.add(i));
} else {
process.exit(1);
}
});
}));
console.timeEnd('* Download and process AdBlock Filter Rules');

View File

@ -88,6 +88,13 @@ const ADGUARD_FILTERS = [
'https://filters.adtidy.org/extension/ublock/filters/7.txt',
// AdGuard Chinese filter (EasyList China + AdGuard Chinese filter)
'https://filters.adtidy.org/extension/ublock/filters/224.txt',
// EasyList Germany filter
[
'https://easylist.to/easylistgermany/easylistgermany.txt',
[
'https://easylist-downloads.adblockplus.org/easylistgermany.txt'
]
],
// Easy Privacy
[
'https://easylist.to/easylist/easyprivacy.txt',