From 31d021dd234cb2c32ef0b808df01a19ee9f29f14 Mon Sep 17 00:00:00 2001 From: SukkaW Date: Fri, 3 Nov 2023 11:43:41 +0800 Subject: [PATCH] Chore: change domain dedupe method --- Build/lib/domain-deduper.js | 3 ++- Build/lib/trie.js | 8 ++------ Source/domainset/reject_sukka.conf | 2 +- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/Build/lib/domain-deduper.js b/Build/lib/domain-deduper.js index 3b209c46..95bb6101 100644 --- a/Build/lib/domain-deduper.js +++ b/Build/lib/domain-deduper.js @@ -20,7 +20,8 @@ const domainDeduper = (inputDomains) => { // if `.example.com` exists, then `example.com` should also be removed const a = d.slice(1); - if (trie.has(a)) { + + if (sets.has(a)) { sets.delete(a); } } diff --git a/Build/lib/trie.js b/Build/lib/trie.js index 8404865f..47a12aef 100644 --- a/Build/lib/trie.js +++ b/Build/lib/trie.js @@ -84,9 +84,7 @@ const createTrie = (from) => { // eslint-disable-next-line guard-for-in -- plain object for (k in node) { if (k === SENTINEL) { - if (includeEqualWithSuffix) { - matches.push($suffix); - } else if ($suffix !== suffix) { + if (includeEqualWithSuffix || $suffix !== suffix) { matches.push($suffix); } @@ -157,11 +155,9 @@ const createTrie = (from) => { */ const has = (suffix) => { let node = root; - let token; for (let i = suffix.length - 1; i >= 0; i--) { - token = suffix[i]; - node = node[token]; + node = node[suffix[i]]; if (typeof node === 'undefined') { return false; diff --git a/Source/domainset/reject_sukka.conf b/Source/domainset/reject_sukka.conf index 03f9c097..824d2503 100644 --- a/Source/domainset/reject_sukka.conf +++ b/Source/domainset/reject_sukka.conf @@ -1450,7 +1450,7 @@ stat.letv.com static.app.m.letv.com # >> Xiaomi (MIUI) -ad.intl.xiaomi.com +.ad.intl.xiaomi.com .ad.mi.com .admob.xiaomi.com .ad1.xiaomi.com