mirror of
https://github.com/SukkaW/Surge.git
synced 2025-12-12 01:00:34 +08:00
Update CDN Hosts + Reject Hosts + Reject Rule Parsing
This commit is contained in:
parent
c148185318
commit
4ce5cb4794
@ -30,7 +30,7 @@ async function processDomainLists(domainListsUrl) {
|
|||||||
const domainSets = new Set();
|
const domainSets = new Set();
|
||||||
|
|
||||||
for await (const line of await fetchRemoteTextAndCreateReadlineInterface(domainListsUrl)) {
|
for await (const line of await fetchRemoteTextAndCreateReadlineInterface(domainListsUrl)) {
|
||||||
if (line.startsWith('!')) {
|
if (line[0] === '!') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,7 +114,7 @@ async function processFilterRules(filterRulesUrl, fallbackUrls, includeThirdPart
|
|||||||
foundDebugDomain = true;
|
foundDebugDomain = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isSubDomain && !domainToBeAddedToBlack.startsWith('.')) {
|
if (isSubDomain && domainToBeAddedToBlack[0] !== '.') {
|
||||||
blacklistDomainSets.add(`.${domainToBeAddedToBlack}`);
|
blacklistDomainSets.add(`.${domainToBeAddedToBlack}`);
|
||||||
} else {
|
} else {
|
||||||
blacklistDomainSets.add(domainToBeAddedToBlack);
|
blacklistDomainSets.add(domainToBeAddedToBlack);
|
||||||
@ -158,7 +158,7 @@ async function processFilterRules(filterRulesUrl, fallbackUrls, includeThirdPart
|
|||||||
|
|
||||||
if (
|
if (
|
||||||
line === ''
|
line === ''
|
||||||
|| line.startsWith('/')
|
|| line[0] === '/'
|
||||||
|| R_KNOWN_NOT_NETWORK_FILTER_PATTERN.test(line)
|
|| R_KNOWN_NOT_NETWORK_FILTER_PATTERN.test(line)
|
||||||
// doesn't include
|
// doesn't include
|
||||||
|| !line.includes('.') // rule with out dot can not be a domain
|
|| !line.includes('.') // rule with out dot can not be a domain
|
||||||
@ -176,13 +176,13 @@ async function processFilterRules(filterRulesUrl, fallbackUrls, includeThirdPart
|
|||||||
// || line.includes('~')
|
// || line.includes('~')
|
||||||
// || line.includes('&')
|
// || line.includes('&')
|
||||||
// || line.includes('%')
|
// || line.includes('%')
|
||||||
|| ((line.includes('/') || line.includes(':')) && !line.includes('://'))
|
|
||||||
// ends with
|
// ends with
|
||||||
|| line.endsWith('.')
|
|| line.endsWith('.')
|
||||||
|| line.endsWith('-')
|
|| line.endsWith('-')
|
||||||
|| line.endsWith('_')
|
|| line.endsWith('_')
|
||||||
// special modifier
|
// special modifier
|
||||||
|| R_KNOWN_NOT_NETWORK_FILTER_PATTERN_2.test(line)
|
|| R_KNOWN_NOT_NETWORK_FILTER_PATTERN_2.test(line)
|
||||||
|
|| ((line.includes('/') || line.includes(':')) && !line.includes('://'))
|
||||||
// || line.includes('$popup')
|
// || line.includes('$popup')
|
||||||
// || line.includes('$removeparam')
|
// || line.includes('$removeparam')
|
||||||
// || line.includes('$popunder')
|
// || line.includes('$popunder')
|
||||||
@ -244,13 +244,17 @@ async function processFilterRules(filterRulesUrl, fallbackUrls, includeThirdPart
|
|||||||
const lineEndsWithCaret = line.endsWith('^');
|
const lineEndsWithCaret = line.endsWith('^');
|
||||||
const lineEndsWithCaretVerticalBar = line.endsWith('^|');
|
const lineEndsWithCaretVerticalBar = line.endsWith('^|');
|
||||||
|
|
||||||
if (line.startsWith('@@')) {
|
if (line[0] === '@' && line[1] === '@') {
|
||||||
if (line.endsWith('$cname')) {
|
if (line.endsWith('$cname')) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
(line.startsWith('@@|') || line.startsWith('@@.'))
|
// (line.startsWith('@@|') || line.startsWith('@@.'))
|
||||||
|
(
|
||||||
|
line[2] === '|'
|
||||||
|
|| line[2] === '.'
|
||||||
|
)
|
||||||
&& (
|
&& (
|
||||||
lineEndsWithCaret
|
lineEndsWithCaret
|
||||||
|| lineEndsWithCaretVerticalBar
|
|| lineEndsWithCaretVerticalBar
|
||||||
@ -358,7 +362,7 @@ async function processFilterRules(filterRulesUrl, fallbackUrls, includeThirdPart
|
|||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!line.startsWith('|') && lineEndsWithCaret) {
|
if (line[0] !== '|' && lineEndsWithCaret) {
|
||||||
const _domain = line.slice(0, -1);
|
const _domain = line.slice(0, -1);
|
||||||
const domain = normalizeDomain(_domain);
|
const domain = normalizeDomain(_domain);
|
||||||
if (domain) {
|
if (domain) {
|
||||||
|
|||||||
@ -96,6 +96,7 @@ vscode-sync-insiders.trafficmanager.net
|
|||||||
|
|
||||||
# NPM
|
# NPM
|
||||||
registry.npmjs.org
|
registry.npmjs.org
|
||||||
|
replicate.npmjs.com
|
||||||
static.npmjs.com
|
static.npmjs.com
|
||||||
static-production.npmjs.com
|
static-production.npmjs.com
|
||||||
registry.npmjs.com
|
registry.npmjs.com
|
||||||
|
|||||||
@ -626,6 +626,12 @@ analytics.infomaniak.com
|
|||||||
.prtrackings.com
|
.prtrackings.com
|
||||||
p.cloudcraft.co
|
p.cloudcraft.co
|
||||||
|
|
||||||
|
upload.qiniup.com
|
||||||
|
upload-z1.qiniup.com
|
||||||
|
upload-z2.qiniup.com
|
||||||
|
upload-na0.qiniup.com
|
||||||
|
upload-as0.qiniup.com
|
||||||
|
|
||||||
.adjust.io
|
.adjust.io
|
||||||
.airbrake.io
|
.airbrake.io
|
||||||
.apsalar.com
|
.apsalar.com
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user