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
|
// if `.example.com` exists, then `example.com` should also be removed
|
||||||
const a = d.slice(1);
|
const a = d.slice(1);
|
||||||
if (trie.has(a)) {
|
|
||||||
|
if (sets.has(a)) {
|
||||||
sets.delete(a);
|
sets.delete(a);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -84,9 +84,7 @@ const createTrie = (from) => {
|
|||||||
// eslint-disable-next-line guard-for-in -- plain object
|
// eslint-disable-next-line guard-for-in -- plain object
|
||||||
for (k in node) {
|
for (k in node) {
|
||||||
if (k === SENTINEL) {
|
if (k === SENTINEL) {
|
||||||
if (includeEqualWithSuffix) {
|
if (includeEqualWithSuffix || $suffix !== suffix) {
|
||||||
matches.push($suffix);
|
|
||||||
} else if ($suffix !== suffix) {
|
|
||||||
matches.push($suffix);
|
matches.push($suffix);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,11 +155,9 @@ const createTrie = (from) => {
|
|||||||
*/
|
*/
|
||||||
const has = (suffix) => {
|
const has = (suffix) => {
|
||||||
let node = root;
|
let node = root;
|
||||||
let token;
|
|
||||||
|
|
||||||
for (let i = suffix.length - 1; i >= 0; i--) {
|
for (let i = suffix.length - 1; i >= 0; i--) {
|
||||||
token = suffix[i];
|
node = node[suffix[i]];
|
||||||
node = node[token];
|
|
||||||
|
|
||||||
if (typeof node === 'undefined') {
|
if (typeof node === 'undefined') {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -1450,7 +1450,7 @@ stat.letv.com
|
|||||||
static.app.m.letv.com
|
static.app.m.letv.com
|
||||||
|
|
||||||
# >> Xiaomi (MIUI)
|
# >> Xiaomi (MIUI)
|
||||||
ad.intl.xiaomi.com
|
.ad.intl.xiaomi.com
|
||||||
.ad.mi.com
|
.ad.mi.com
|
||||||
.admob.xiaomi.com
|
.admob.xiaomi.com
|
||||||
.ad1.xiaomi.com
|
.ad1.xiaomi.com
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user