mirror of
https://github.com/SukkaW/Surge.git
synced 2025-12-12 01:00:34 +08:00
Chore: change domain dedupe method
This commit is contained in:
parent
5701fc9b70
commit
31d021dd23
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user