fet: reduce LOC by reducing comments
This commit is contained in:
@@ -54,26 +54,22 @@ export async function validateMonitorUrl(url: string): Promise<string | null> {
|
||||
return "Invalid URL";
|
||||
}
|
||||
|
||||
// Only allow http and https
|
||||
if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
|
||||
return `Blocked scheme: ${parsed.protocol} — only http: and https: are allowed`;
|
||||
}
|
||||
|
||||
const hostname = parsed.hostname.toLowerCase();
|
||||
|
||||
// Block localhost by name
|
||||
if (BLOCKED_HOSTNAMES.includes(hostname)) {
|
||||
return "Blocked hostname: localhost is not allowed";
|
||||
}
|
||||
|
||||
// Block non-public TLDs
|
||||
for (const tld of BLOCKED_TLDS) {
|
||||
if (hostname.endsWith(tld)) {
|
||||
return `Blocked TLD: ${tld} is not allowed`;
|
||||
}
|
||||
}
|
||||
|
||||
// Resolve DNS and check all IPs
|
||||
try {
|
||||
const ips: string[] = [];
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user