fix: better whois and smaller tld list
This commit is contained in:
+22
-9
@@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, onBeforeMount } from "vue";
|
||||
import { WhoIs } from "./lib/whois";
|
||||
import { isDomainAvailable } from "./lib/whois";
|
||||
import { DomainFactory } from "./lib/factory";
|
||||
|
||||
enum State {
|
||||
@@ -16,7 +16,6 @@ function getLang() {
|
||||
}
|
||||
|
||||
const visible = ref<boolean>(false);
|
||||
const whois = ref<WhoIs>(new WhoIs());
|
||||
const factory = ref<DomainFactory>(new DomainFactory());
|
||||
const domain = ref<string | null>(null);
|
||||
const domainAvailable = ref<boolean>(false);
|
||||
@@ -40,11 +39,10 @@ function newDomain() {
|
||||
}
|
||||
|
||||
function checkAvailability() {
|
||||
if (!whois.value.error && domain.value) {
|
||||
if (domain.value) {
|
||||
const promiseDomain = domain.value;
|
||||
state.value = State.Fetching;
|
||||
whois.value
|
||||
.isDomainAvailable(promiseDomain)
|
||||
isDomainAvailable(promiseDomain)
|
||||
.then((available) => {
|
||||
if (domain.value !== promiseDomain) {
|
||||
return; // domain changed
|
||||
@@ -63,9 +61,24 @@ function checkAvailability() {
|
||||
}
|
||||
}
|
||||
|
||||
function getTextClass() {
|
||||
if (!domain.value || domain.value.length < 15) {
|
||||
return "text-5xl";
|
||||
}
|
||||
if (domain.value.length < 20) {
|
||||
return "text-4xl";
|
||||
}
|
||||
if (domain.value.length < 25) {
|
||||
return "text-3xl";
|
||||
}
|
||||
if (domain.value.length < 30) {
|
||||
return "text-2xl";
|
||||
}
|
||||
return "text-xl";
|
||||
}
|
||||
|
||||
onBeforeMount(async () => {
|
||||
await whois.value.init();
|
||||
await factory.value.init(whois.value);
|
||||
await factory.value.init();
|
||||
newDomain();
|
||||
state.value = State.Ready;
|
||||
});
|
||||
@@ -86,8 +99,8 @@ onMounted(() => {
|
||||
<template>
|
||||
<div :style="{ display: visible ? 'inherit' : 'none' }">
|
||||
<div class="card bg-base-100 w-xl max-w-svw shrink-0 shadow-2xl">
|
||||
<div class="card-body">
|
||||
<h1 class="text-5xl font-bold font-doto">
|
||||
<div class="card-body overflow-hidden">
|
||||
<h1 class="font-bold" :class="getTextClass()">
|
||||
<span
|
||||
v-if="state !== State.Loading && domain"
|
||||
class="inline-block me-2"
|
||||
|
||||
Reference in New Issue
Block a user