feat: whois timeout
Lint / Oxlint (push) Successful in 50s
Lint / ESLint (push) Successful in 58s
Lint / TypeScript (push) Successful in 58s
Deploy / Build (push) Successful in 1m4s
Deploy / Deploy to Stapler (push) Successful in 7m9s

This commit is contained in:
2026-06-26 14:16:33 +02:00
parent e40a082c2a
commit e5ab509c29
2 changed files with 6 additions and 14 deletions
+1 -1
View File
@@ -129,7 +129,7 @@ watch(i18n.locale, newDomain);
{{ $t("button.new_domain") }} {{ $t("button.new_domain") }}
</button> </button>
<br /> <br />
<p v-if="domain && state === State.Ready"> <p v-if="domain">
<small <small
><a class="underline" href="#" @click.prevent="removeExt">{{ ><a class="underline" href="#" @click.prevent="removeExt">{{
$t("page_random.dont_suggest", { ext: `.${domain.extension}` }) $t("page_random.dont_suggest", { ext: `.${domain.extension}` })
+5 -13
View File
@@ -1,10 +1,4 @@
import type { import type { WhoIsResponse, WhoIsData, WhoIsEvent, WhoIsIpAddresses, Domain } from "@/types";
WhoIsResponse,
WhoIsData,
WhoIsEvent,
WhoIsIpAddresses,
Domain,
} from "@/types";
function checkEvents(events: WhoIsEvent[]): boolean { function checkEvents(events: WhoIsEvent[]): boolean {
for (const event of events) { for (const event of events) {
@@ -21,18 +15,16 @@ function checkIpAddresses(ipAddresses: WhoIsIpAddresses): boolean {
function checkWhoIsData(data: WhoIsData): boolean { function checkWhoIsData(data: WhoIsData): boolean {
return ( return (
checkEvents(data.events) && checkEvents(data.events) && checkIpAddresses(data.ipAddresses) && data.nameservers.length === 0
checkIpAddresses(data.ipAddresses) &&
data.nameservers.length === 0
); );
} }
export async function isDomainAvailable(domain: Domain): Promise<boolean> { export async function isDomainAvailable(domain: Domain): Promise<boolean> {
domain.searching = true; domain.searching = true;
try { try {
const response = await fetch( const response = await fetch(`https://whois.klemek.fr/api/lookup/${domain.name}`, {
`https://whois.klemek.fr/api/lookup/${domain.name}`, signal: AbortSignal.timeout(5000),
); });
const content: WhoIsResponse = await response.json(); const content: WhoIsResponse = await response.json();
domain.available = checkWhoIsData(content.data); domain.available = checkWhoIsData(content.data);
} catch { } catch {