mirror of
https://github.com/SukkaW/Surge.git
synced 2026-01-29 01:51:52 +08:00
Fix Reject Hosts parsing
This commit is contained in:
@@ -6,6 +6,10 @@ module.exports.isDomainLoose = (domain) => {
|
||||
};
|
||||
|
||||
module.exports.normalizeDomain = (domain) => {
|
||||
if (domain == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const { isIcann, isPrivate, hostname, isIp } = parse(domain, { allowPrivateDomains: true });
|
||||
if (isIp) {
|
||||
return null;
|
||||
|
||||
@@ -203,7 +203,7 @@ async function processFilterRules (filterRulesUrl, fallbackUrls, includeThirdPar
|
||||
&& (!filter.isRegex())
|
||||
&& (!filter.isFullRegex())
|
||||
) {
|
||||
const hostname = filter.getHostname();
|
||||
const hostname = normalizeDomain(filter.getHostname());
|
||||
if (hostname) {
|
||||
if (filter.isException() || filter.isBadFilter()) {
|
||||
addToWhiteList(hostname);
|
||||
@@ -222,6 +222,8 @@ async function processFilterRules (filterRulesUrl, fallbackUrls, includeThirdPar
|
||||
if (filter.firstParty()) {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user