diff --git a/web/src/lib/api/domaininfo.ts b/web/src/lib/api/domaininfo.ts new file mode 100644 index 00000000..98a065d7 --- /dev/null +++ b/web/src/lib/api/domaininfo.ts @@ -0,0 +1,30 @@ +// This file is part of the happyDomain (R) project. +// Copyright (c) 2022-2026 happyDomain +// Authors: Pierre-Olivier Mercier, et al. +// +// This program is offered under a commercial and under the AGPL license. +// For commercial licensing, contact us at . +// +// For AGPL licensing: +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +import { postDomaininfoByDomain } from "$lib/api-base/sdk.gen"; +import type { DomainInfo } from "$lib/model/domaininfo"; +import { unwrapSdkResponse } from "./errors"; + +export async function getDomainInfo(domain: string): Promise { + return unwrapSdkResponse( + await postDomaininfoByDomain({ path: { domain } }), + ) as DomainInfo; +} diff --git a/web/src/lib/components/DomainInfoDisplay.svelte b/web/src/lib/components/DomainInfoDisplay.svelte new file mode 100644 index 00000000..618c25a1 --- /dev/null +++ b/web/src/lib/components/DomainInfoDisplay.svelte @@ -0,0 +1,227 @@ + + + + +

+ {info.name ?? domain} +

+ + +{#if info.status && info.status.length > 0} +
+

{$t("domaininfo.status")}

+
+ {#each info.status as code} + + {code} + + {/each} +
+ {#if info.status.length === 1} + {@const desc = $t( + `domaininfo.status-descriptions.${info.status[0]}`, + )} + {#if desc && !desc.startsWith("domaininfo.")} +

{desc}

+ {/if} + {/if} +
+{/if} + + +
+
+ + +

+ + {$t("domaininfo.creation-date")} +

+ {#if info.creation} +

{formatDate(info.creation)}

+ {:else} +

+ {$t("domaininfo.no-creation")} +

+ {/if} + + +

+ + {$t("domaininfo.expiration-date")} +

+ {#if info.expiration} + {@const days = daysUntilExpiration(info.expiration)} + {@const color = expirationColor(info.expiration)} + {@const expiresLabel = days < 0 ? $t("domaininfo.expired", { days: Math.abs(days) }) : days === 0 ? $t("domaininfo.expires-today") : $t("domaininfo.expires-in", { days })} +

+ {formatDate(info.expiration)} +

+
+
+
+

+ {#if days < 0} + {$t("domaininfo.expired", { days: Math.abs(days) })} + {:else if days === 0} + {$t("domaininfo.expires-today")} + {:else} + {$t("domaininfo.expires-in", { days })} + {/if} +

+ {:else} +

+ {$t("domaininfo.no-expiration")} +

+ {/if} + +
+
+
+ + + + + + + + + {$t("domaininfo.registrar")} + + + + {#if info.registrar} +

{info.registrar}

+ {#if info.registrar_url} + + + {$t("domaininfo.registrar-url")} + + {/if} + {:else} +

+ {$t("domaininfo.no-registrar")} +

+ {/if} +
+
+ + + + {#if info.nameservers && info.nameservers.length > 0} + + + + + + {$t("domaininfo.nameservers")} + + + + {#each info.nameservers as ns} + {ns} + {/each} + + + + {/if} +
diff --git a/web/src/lib/components/Header.svelte b/web/src/lib/components/Header.svelte index 68e09069..0bd16111 100644 --- a/web/src/lib/components/Header.svelte +++ b/web/src/lib/components/Header.svelte @@ -138,6 +138,12 @@ > {$t("menu.dns-resolver")} + + {$t("menu.whois")} + . +// +// For AGPL licensing: +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +import type { HappydnsDomainInfo } from "$lib/api-base/types.gen"; + +export type DomainInfo = HappydnsDomainInfo; diff --git a/web/src/routes/whois/[[domain]]/+page.svelte b/web/src/routes/whois/[[domain]]/+page.svelte new file mode 100644 index 00000000..1404a3e3 --- /dev/null +++ b/web/src/routes/whois/[[domain]]/+page.svelte @@ -0,0 +1,249 @@ + + + + + + + {$t("domaininfo.page-title")} + {domain ? domain : ""} + - happyDomain + + + +{#if domain} + + + +
+ +
+ + + +
+ {@html $t("domaininfo.domain-description", { + domain: `example.com`, + })} +
+ + {#if $domains} + {#each $domains as dn (dn.id)} + + {/each} + {/if} + +
+
+ +
+
+
+ + + {#if request_pending} + +
+ +

{$t("common.spinning")}…

+
+ + {:else if not_found} + +

+ + {domain} +

+
+
+
+ +

{$t("domaininfo.domain-not-found")}

+
+
+
+ + {:else if error_response !== null} + +

+ + {$t("domaininfo.error")} +

+
+
+
+ +

{error_response}

+
+
+
+ + {:else if info !== null} + + + + {/if} +
+
+{:else} +
+ + + +
+
+
+ + + +
+ {@html $t("domaininfo.domain-description", { + domain: `example.com`, + })} +
+ + {#if $domains} + {#each $domains as dn (dn.id)} + + {/each} + {/if} + +
+
+ +
+
+
+
+ +
+
+{/if} diff --git a/web/src/routes/whois/[[domain]]/+page.ts b/web/src/routes/whois/[[domain]]/+page.ts new file mode 100644 index 00000000..cd16169e --- /dev/null +++ b/web/src/routes/whois/[[domain]]/+page.ts @@ -0,0 +1,28 @@ +// This file is part of the happyDomain (R) project. +// Copyright (c) 2022-2026 happyDomain +// Authors: Pierre-Olivier Mercier, et al. +// +// This program is offered under a commercial and under the AGPL license. +// For commercial licensing, contact us at . +// +// For AGPL licensing: +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +import type { Load } from "@sveltejs/kit"; + +export const load: Load = async ({ params }) => { + return { + domain: params.domain, + }; +};