@@ -4,6 +4,9 @@ import { resolve } from 'path';
44import { readFile } from 'fs/promises' ;
55
66const DISPOSABLE_DOMAINS_URL = 'https://raw.githubusercontent.com/disposable-email-domains/disposable-email-domains/master/disposable_email_blocklist.conf' ;
7+ const LOCAL_DISPOSABLE_DOMAINS = new Set ( [
8+ 'ztzt.net' ,
9+ ] ) ;
710let disposableDomainsCache = null ;
811let disposableDomainsTimestamp = 0 ;
912const DOMAINS_CACHE_TTL = 3600000 ;
@@ -12,15 +15,18 @@ async function loadDisposableDomains() {
1215 if ( disposableDomainsCache && ( Date . now ( ) - disposableDomainsTimestamp < DOMAINS_CACHE_TTL ) ) {
1316 return disposableDomainsCache ;
1417 }
18+ const merged = new Set ( LOCAL_DISPOSABLE_DOMAINS ) ;
1519 try {
1620 const res = await fetchWithTimeout ( DISPOSABLE_DOMAINS_URL , { } , 10000 ) ;
1721 const text = await res . text ( ) ;
18- disposableDomainsCache = new Set ( text . split ( '\n' ) . map ( l => l . trim ( ) . toLowerCase ( ) ) . filter ( Boolean ) ) ;
19- disposableDomainsTimestamp = Date . now ( ) ;
20- return disposableDomainsCache ;
21- } catch {
22- return disposableDomainsCache || new Set ( ) ;
23- }
22+ for ( const line of text . split ( '\n' ) ) {
23+ const domain = line . trim ( ) . toLowerCase ( ) ;
24+ if ( domain ) merged . add ( domain ) ;
25+ }
26+ } catch { }
27+ disposableDomainsCache = merged ;
28+ disposableDomainsTimestamp = Date . now ( ) ;
29+ return disposableDomainsCache ;
2430}
2531
2632export async function isDisposableEmail ( email ) {
0 commit comments