diff --git a/src/components/PageRandom.vue b/src/components/PageRandom.vue index 207844c..e21ea4d 100644 --- a/src/components/PageRandom.vue +++ b/src/components/PageRandom.vue @@ -129,7 +129,7 @@ watch(i18n.locale, newDomain); {{ $t("button.new_domain") }}
-

+

{{ $t("page_random.dont_suggest", { ext: `.${domain.extension}` }) diff --git a/src/lib/whois.ts b/src/lib/whois.ts index b47bec3..338263e 100644 --- a/src/lib/whois.ts +++ b/src/lib/whois.ts @@ -1,10 +1,4 @@ -import type { - WhoIsResponse, - WhoIsData, - WhoIsEvent, - WhoIsIpAddresses, - Domain, -} from "@/types"; +import type { WhoIsResponse, WhoIsData, WhoIsEvent, WhoIsIpAddresses, Domain } from "@/types"; function checkEvents(events: WhoIsEvent[]): boolean { for (const event of events) { @@ -21,18 +15,16 @@ function checkIpAddresses(ipAddresses: WhoIsIpAddresses): boolean { function checkWhoIsData(data: WhoIsData): boolean { return ( - checkEvents(data.events) && - checkIpAddresses(data.ipAddresses) && - data.nameservers.length === 0 + checkEvents(data.events) && checkIpAddresses(data.ipAddresses) && data.nameservers.length === 0 ); } export async function isDomainAvailable(domain: Domain): Promise { domain.searching = true; try { - const response = await fetch( - `https://whois.klemek.fr/api/lookup/${domain.name}`, - ); + const response = await fetch(`https://whois.klemek.fr/api/lookup/${domain.name}`, { + signal: AbortSignal.timeout(5000), + }); const content: WhoIsResponse = await response.json(); domain.available = checkWhoIsData(content.data); } catch {