This commit is contained in:
Owen
2025-10-04 18:36:44 -07:00
parent 3123f858bb
commit c2c907852d
320 changed files with 35785 additions and 2984 deletions

View File

@@ -163,6 +163,26 @@ export function validateHeaders(headers: string): boolean {
});
}
export function isSecondLevelDomain(domain: string): boolean {
if (!domain || typeof domain !== 'string') {
return false;
}
const trimmedDomain = domain.trim().toLowerCase();
// Split into parts
const parts = trimmedDomain.split('.');
// Should have exactly 2 parts for a second-level domain (e.g., "example.com")
if (parts.length !== 2) {
return false;
}
// Check if the TLD part is valid
const tld = parts[1].toUpperCase();
return validTlds.includes(tld);
}
const validTlds = [
"AAA",
"AARP",