mirror of
https://github.com/SukkaW/Surge.git
synced 2025-12-17 20:00:27 +08:00
Update Reject Hosts
This commit is contained in:
parent
e1cea18663
commit
505f7544ed
@ -14,6 +14,7 @@ import { PREDEFINED_WHITELIST } from './constants/reject-data-source';
|
|||||||
await writeHostsToTrie(trie, 'https://cdn.jsdelivr.net/gh/jerryn70/GoodbyeAds@master/Extension/GoodbyeAds-Xiaomi-Extension.txt', true);
|
await writeHostsToTrie(trie, 'https://cdn.jsdelivr.net/gh/jerryn70/GoodbyeAds@master/Extension/GoodbyeAds-Xiaomi-Extension.txt', true);
|
||||||
|
|
||||||
await runWhiteOnSource(path.join(SOURCE_DIR, 'domainset', 'reject.conf'), trie);
|
await runWhiteOnSource(path.join(SOURCE_DIR, 'domainset', 'reject.conf'), trie);
|
||||||
|
await runWhiteOnSource(path.join(SOURCE_DIR, 'non_ip', 'reject.conf'), trie);
|
||||||
|
|
||||||
for (let i = 0, len = PREDEFINED_WHITELIST.length; i < len; i++) {
|
for (let i = 0, len = PREDEFINED_WHITELIST.length; i < len; i++) {
|
||||||
trie.whitelist(PREDEFINED_WHITELIST[i]);
|
trie.whitelist(PREDEFINED_WHITELIST[i]);
|
||||||
@ -28,10 +29,19 @@ async function runWhiteOnSource(sourceFile: string, trie: HostnameSmolTrie) {
|
|||||||
for await (const line of readFileByLine(sourceFile)) {
|
for await (const line of readFileByLine(sourceFile)) {
|
||||||
const l = processLine(line);
|
const l = processLine(line);
|
||||||
if (l) {
|
if (l) {
|
||||||
|
if (l.includes(',')) {
|
||||||
|
const [type, domain] = l.split(',', 3);
|
||||||
|
if (type === 'DOMAIN') {
|
||||||
|
trie.whitelist(domain, false);
|
||||||
|
} else if (type === 'DOMAIN-SUFFIX') {
|
||||||
|
trie.whitelist(domain, true);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
trie.whitelist(l);
|
trie.whitelist(l);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function writeHostsToTrie(trie: HostnameSmolTrie, hostsUrl: string, includeAllSubDomain = false) {
|
async function writeHostsToTrie(trie: HostnameSmolTrie, hostsUrl: string, includeAllSubDomain = false) {
|
||||||
const hosts = await processHosts(dummySpan, hostsUrl, [], includeAllSubDomain);
|
const hosts = await processHosts(dummySpan, hostsUrl, [], includeAllSubDomain);
|
||||||
|
|||||||
@ -2211,6 +2211,7 @@ sentry.d.mi.com
|
|||||||
.hnzkclouds.com
|
.hnzkclouds.com
|
||||||
|
|
||||||
.data.intl.miui.com
|
.data.intl.miui.com
|
||||||
|
.stats.miui.com
|
||||||
|
|
||||||
.cloudcontrol.xiaomixiaoai.com
|
.cloudcontrol.xiaomixiaoai.com
|
||||||
.crashguard.me
|
.crashguard.me
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user