fet: reduce LOC by reducing comments

This commit is contained in:
2026-03-28 18:05:29 +04:00
parent 005f635fab
commit 8e554498f0
20 changed files with 2 additions and 246 deletions
-4
View File
@@ -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 {