Fix: enable domain check for some reject data source

This commit is contained in:
SukkaW
2024-01-07 01:05:20 +08:00
parent 61b88c5807
commit ca169b9db5
6 changed files with 32 additions and 19 deletions

View File

@@ -5,11 +5,14 @@ export const normalizeDomain = (domain: string) => {
if (isProbablyIpv4(domain)) return null;
const parsed = tldts.parse2(domain);
if (parsed.isIp) return null;
// if (parsed.isIp) return null;
if (!parsed.hostname) return null;
if (!parsed.isIcann && !parsed.isPrivate) return null;
const h = parsed.hostname;
if (!h) return null;
let h = parsed.hostname;
if (h[0] === '.') h = h.slice(1);
if (h.endsWith('.')) h = h.slice(0, -1);
return h[0] === '.' ? h.slice(1) : h;
if (h) return h;
return null;
};