Skip to content

Commit

Permalink
Chore: change domain dedupe method
Browse files Browse the repository at this point in the history
  • Loading branch information
SukkaW committed Nov 3, 2023
1 parent 5701fc9 commit 31d021d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
3 changes: 2 additions & 1 deletion Build/lib/domain-deduper.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
8 changes: 2 additions & 6 deletions Build/lib/trie.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion Source/domainset/reject_sukka.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 31d021d

Please sign in to comment.