fix: blacklist and tld-list link
This commit is contained in:
+19
-2
@@ -142,8 +142,25 @@ onMounted(() => {
|
||||
<span class="loading loading-dots loading-xs"></span>
|
||||
</p>
|
||||
<div v-else-if="state === State.Ready && domainAvailable" class="py-6">
|
||||
<span v-if="lang === 'french'">Ce domaine semble disponible !</span>
|
||||
<span v-else>This domain seems available!</span>
|
||||
<span v-if="lang === 'french'"
|
||||
>Ce domaine semble
|
||||
<a
|
||||
:href="`https://tld-list.com/fr/tld/${domain?.split('.')[1]}`"
|
||||
target="_blank"
|
||||
class="underline"
|
||||
>disponible</a
|
||||
>
|
||||
!</span
|
||||
>
|
||||
<span v-else
|
||||
>This domain seems
|
||||
<a
|
||||
:href="`https://tld-list.com/tld/${domain?.split('.')[1]}`"
|
||||
target="_blank"
|
||||
class="underline"
|
||||
>available</a
|
||||
>!</span
|
||||
>
|
||||
</div>
|
||||
<div v-else-if="state === State.Ready && !domainAvailable" class="py-6">
|
||||
<span v-if="lang === 'french'">Ce domaine n'est pas disponible.</span>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+17
-23
@@ -1,4 +1,6 @@
|
||||
const BLACKLIST = ["able", "gle", "pin", "mil"];
|
||||
import raw_blacklist from "@/data/blacklist.txt";
|
||||
|
||||
const BLACKLIST = raw_blacklist.split("\n");
|
||||
|
||||
export async function getTLDList(): Promise<string[]> {
|
||||
const response = await fetch(
|
||||
@@ -7,27 +9,19 @@ export async function getTLDList(): Promise<string[]> {
|
||||
const content = await response.text();
|
||||
const tldList: string[] = [];
|
||||
// @ts-expect-error - not empty string
|
||||
content
|
||||
.split("// ===END ICANN DOMAINS===")[0]
|
||||
.split("\n")
|
||||
.forEach((line) => {
|
||||
line = line.trim().toLowerCase();
|
||||
if (
|
||||
line.length &&
|
||||
!line.startsWith("//") &&
|
||||
!line.startsWith("*") &&
|
||||
!line.startsWith("#") &&
|
||||
!line.startsWith("xn--") &&
|
||||
line.replace(/[^\x20-\x7F]/g, "") === line &&
|
||||
!BLACKLIST.includes(line)
|
||||
) {
|
||||
// tldList.forEach((other) => {
|
||||
// if (line.endsWith(`.${other}`)) {
|
||||
// tldList.splice(tldList.indexOf(other), 1);
|
||||
// }
|
||||
// });
|
||||
tldList.push(line);
|
||||
}
|
||||
});
|
||||
content.split("\n").forEach((line) => {
|
||||
line = line.trim().toLowerCase();
|
||||
if (
|
||||
line.length &&
|
||||
!line.startsWith("//") &&
|
||||
!line.startsWith("*") &&
|
||||
!line.startsWith("#") &&
|
||||
!line.startsWith("xn--") &&
|
||||
line.replace(/[^\x20-\x7F]/g, "") === line &&
|
||||
!BLACKLIST.includes(line)
|
||||
) {
|
||||
tldList.push(line);
|
||||
}
|
||||
});
|
||||
return tldList;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user