Update Rules

This commit is contained in:
SukkaW 2021-11-22 23:28:37 +08:00
parent 22e904bd21
commit 25b04ce4b5
5 changed files with 484 additions and 197 deletions

View File

@ -142,16 +142,6 @@ async function processFilterRules(filterRulesUrl) {
console.log(`Import ${filterRuleBlacklistDomainSets.size} rules from adguard filters!`); console.log(`Import ${filterRuleBlacklistDomainSets.size} rules from adguard filters!`);
// Remove whitelist from the domain sets
console.log(`Remove whitelist from the domain sets!`);
for (const domain of domainSets) {
for (const white of filterRuleWhitelistDomainSets) {
if (domain.includes(white) || white.includes(domain)) {
domainSets.delete(domain);
}
}
}
// Read DOMAIN Keyword // Read DOMAIN Keyword
const domainKeywordsSet = new Set(); const domainKeywordsSet = new Set();
await fsPromises.readFile(pathResolve(__dirname, '../List/non_ip/reject.conf'), { encoding: 'utf-8' }).then(data => { await fsPromises.readFile(pathResolve(__dirname, '../List/non_ip/reject.conf'), { encoding: 'utf-8' }).then(data => {
@ -172,20 +162,36 @@ async function processFilterRules(filterRulesUrl) {
bar2.start(len, 0); bar2.start(len, 0);
for (const domain of domainSets) { for (const domain of domainSets) {
for (const keyword of domainKeywordsSet) { let shouldContinue = false;
if (domain.includes(keyword)) {
for (const white of filterRuleWhitelistDomainSets) {
if (domain.includes(white) || white.includes(domain)) {
domainSets.delete(domain); domainSets.delete(domain);
continue; shouldContinue = true;
break;
} }
} }
if (domain.startsWith('.')) { if (shouldContinue) {
for (const domain2 of domainSets) { continue;
if (domain2 !== domain) { }
if (domain2.endsWith(domain) || `.${domain2}` === domain) {
domainSets.delete(domain2); for (const keyword of domainKeywordsSet) {
} if (domain.includes(keyword) || keyword.includes(domain)) {
} domainSets.delete(domain);
shouldContinue = true;
break;
}
}
if (shouldContinue) {
continue;
}
for (const domain2 of domainSets) {
if (domain2.startsWith('.') && domain2 !== domain && (domain.endsWith(domain2) || `.${domain}` === domain2)) {
domainSets.delete(domain);
break;
} }
} }
@ -194,5 +200,5 @@ async function processFilterRules(filterRulesUrl) {
bar2.stop(); bar2.stop();
return fsPromises.writeFile(pathResolve(__dirname, '../List/domainset/reject.conf'), [...domainSets].join('\n')); return fsPromises.writeFile(pathResolve(__dirname, '../List/domainset/reject.conf'), `${[...domainSets].join('\n')}\n`);
})(); })();

View File

@ -80,6 +80,7 @@ cdnjs.cat.net
fonts.cat.net fonts.cat.net
ajax.cat.net ajax.cat.net
gravatar.cat.net gravatar.cat.net
.rsb.net
# >> Microsoft CDN # >> Microsoft CDN
.aspnetcdn.com .aspnetcdn.com

View File

@ -1,3 +1,3 @@
mask.icloud.com mask.icloud.com
mask-h2.icloud.com mask-h2.icloud.com
mask-api.icloud.com mask-api.icloud.com

File diff suppressed because it is too large Load Diff

View File

@ -562,6 +562,7 @@ analytics.slashdotmedia.com
.bluekai.com .bluekai.com
.bkrtx.com .bkrtx.com
.ads.pro-market.net .ads.pro-market.net
.stat.xtom.com
# >> Apple # >> Apple
metrics.apple.com metrics.apple.com
@ -577,6 +578,7 @@ stocks-analytics-events.news.apple-dns.net
.iadsdk.apple.com .iadsdk.apple.com
.iad.apple.com .iad.apple.com
.qwapi.com .qwapi.com
.wwads.cn
# >> Spotify # >> Spotify
adeventtracker.spotify.com adeventtracker.spotify.com