From e883073ea7b7567dccc6eaf0d6162dd579c3dde4 Mon Sep 17 00:00:00 2001 From: Klemek Date: Fri, 26 Jun 2026 14:26:31 +0200 Subject: [PATCH] fix: tld-list link with correct extension --- src/components/PageInput.vue | 2 +- src/components/PageRandom.vue | 4 ++-- src/lib/factory.ts | 15 +++++++++++++-- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/components/PageInput.vue b/src/components/PageInput.vue index 681b071..a4f3622 100644 --- a/src/components/PageInput.vue +++ b/src/components/PageInput.vue @@ -62,7 +62,7 @@ function newDomain() {  {{ $t("seems") }} {{ $t("available") }} {{ $t("this_domain") }} {{ $t("seems") }} {{ $t("available") }} tldEscaped.length + 2) { const domain = `${word.substring(0, word.length - tldEscaped.length)}.${tld}`; @@ -93,8 +97,8 @@ export class DomainFactory { }); } - removeExt(ext: string): void { - this.tldList = this.tldList.filter((tld: string) => tld !== ext && !tld.endsWith(ext)); + removeExtensions(...extensions: string[]): void { + this.ignoredTldList.push(...extensions); } newDomain(domain: string): Domain { @@ -106,6 +110,10 @@ export class DomainFactory { }; } + ignoredTld(tld: string): boolean { + return this.ignoredTldList.some((ignoredTld: string) => tld.endsWith(ignoredTld)); + } + allFromWord(word: string): Promise { const escapedWord = this.escapeWord(word.replace(/ /gm, "-")); return new Promise((resolve, reject) => { @@ -113,6 +121,9 @@ export class DomainFactory { .then(() => { const domains = []; for (const tld of shuffled(this.tldList.slice())) { + if (this.ignoredTld(tld)) { + continue; + } const tldEscaped: string = tld.replace(".", ""); if (escapedWord.endsWith(tldEscaped) && escapedWord.length >= tldEscaped.length + 2) { const domain = `${escapedWord.substring(0, escapedWord.length - tldEscaped.length)}.${tld}`;