ソースを参照

Handle badfilter syntax correctly

SukkaW 3 年 前
コミット
138245154d
2 ファイル変更7 行追加2 行削除
  1. 1 1
      Build/build-reject-domainset.js
  2. 6 1
      Build/lib/parse-filter.js

+ 1 - 1
Build/build-reject-domainset.js

@@ -10,7 +10,7 @@ const threads = Math.max(require('os').cpus().length, 12);
 
   // Parse from remote hosts & domain lists
   (await Promise.all([
-    // processHosts('https://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=0&mimetype=plaintext', true),
+    processHosts('https://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=0&mimetype=plaintext', true),
     processHosts('https://raw.githubusercontent.com/hoshsadiq/adblock-nocoin-list/master/hosts.txt'),
     processHosts('https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/data/hosts/spy.txt')
   ])).forEach(hosts => {

+ 6 - 1
Build/lib/parse-filter.js

@@ -97,7 +97,12 @@ async function processFilterRules(filterRulesUrl) {
       return;
     }
 
-    if (line.startsWith('@@||')
+    if (line.startsWith('||') && line.endsWith('^$badfilter')) {
+      const domain = line.replaceAll('||', '').replaceAll('^$badfilter', '').trim();
+      if (rDomain.test(domain)) {
+        whitelistDomainSets.add(domain);
+      }
+    } else if (line.startsWith('@@||')
       && (
         line.endsWith('^')
         || line.endsWith('^|')