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!`);
// 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
const domainKeywordsSet = new Set();
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);
for (const domain of domainSets) {
for (const keyword of domainKeywordsSet) {
if (domain.includes(keyword)) {
let shouldContinue = false;
for (const white of filterRuleWhitelistDomainSets) {
if (domain.includes(white) || white.includes(domain)) {
domainSets.delete(domain);
continue;
shouldContinue = true;
break;
}
}
if (domain.startsWith('.')) {
for (const domain2 of domainSets) {
if (domain2 !== domain) {
if (domain2.endsWith(domain) || `.${domain2}` === domain) {
domainSets.delete(domain2);
}
}
if (shouldContinue) {
continue;
}
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();
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
ajax.cat.net
gravatar.cat.net
.rsb.net
# >> Microsoft CDN
.aspnetcdn.com

View File

@ -1,3 +1,3 @@
mask.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
.bkrtx.com
.ads.pro-market.net
.stat.xtom.com
# >> Apple
metrics.apple.com
@ -577,6 +578,7 @@ stocks-analytics-events.news.apple-dns.net
.iadsdk.apple.com
.iad.apple.com
.qwapi.com
.wwads.cn
# >> Spotify
adeventtracker.spotify.com