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") }}
</button>
<br />
<p v-if="domain && state === State.Ready">
<p v-if="domain">
<small
><a class="underline" href="#" @click.prevent="removeExt">{{
$t("page_random.dont_suggest", { ext: `.${domain.extension}` })
+5 -13
View File
@@ -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<boolean> {
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 {