From d3adc4b4ef3e4faa67be569b202b299f2f967bf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Gangloff?= Date: Fri, 27 Dec 2024 21:37:19 +0100 Subject: [PATCH] feat: add link on domain name tags --- assets/App.tsx | 1 + assets/components/tracking/DomainToTag.tsx | 21 ++++++++++ .../tracking/watchlist/TrackedDomainTable.tsx | 3 +- .../tracking/watchlist/WatchlistCard.tsx | 16 ++----- assets/pages/search/DomainSearchPage.tsx | 9 +++- src/Service/RDAPService.php | 6 +-- translations/translations.pot | 42 +++++++++---------- 7 files changed, 59 insertions(+), 39 deletions(-) create mode 100644 assets/components/tracking/DomainToTag.tsx diff --git a/assets/App.tsx b/assets/App.tsx index 0a4613a..6aa5f1a 100644 --- a/assets/App.tsx +++ b/assets/App.tsx @@ -96,6 +96,7 @@ export default function App() { }/> }/> + }/> }/> }/> }/> diff --git a/assets/components/tracking/DomainToTag.tsx b/assets/components/tracking/DomainToTag.tsx new file mode 100644 index 0000000..a8e94f7 --- /dev/null +++ b/assets/components/tracking/DomainToTag.tsx @@ -0,0 +1,21 @@ +import {Tag} from "antd"; +import {DeleteOutlined, ExclamationCircleOutlined} from "@ant-design/icons"; +import punycode from "punycode/punycode"; +import {Link} from "react-router-dom"; +import React from "react"; + +export function DomainToTag({domain}: { domain: { ldhName: string, deleted: boolean, status: string[] } }) { + return + : + domain.status.includes('redemption period') ? : + domain.status.includes('pending delete') ? : null + }>{punycode.toUnicode(domain.ldhName)} + +} \ No newline at end of file diff --git a/assets/components/tracking/watchlist/TrackedDomainTable.tsx b/assets/components/tracking/watchlist/TrackedDomainTable.tsx index 8116d58..297b22f 100644 --- a/assets/components/tracking/watchlist/TrackedDomainTable.tsx +++ b/assets/components/tracking/watchlist/TrackedDomainTable.tsx @@ -7,6 +7,7 @@ import {rdapStatusCodeDetailTranslation} from "../../../utils/functions/rdapTran import {eppStatusCodeToColor} from "../../../utils/functions/eppStatusCodeToColor"; import {Link} from "react-router-dom"; import {ExceptionOutlined, MonitorOutlined} from '@ant-design/icons' +import {DomainToTag} from "../DomainToTag"; export function TrackedDomainTable() { @@ -42,7 +43,7 @@ export function TrackedDomainTable() { return { key: d.ldhName, - ldhName: d.ldhName, + ldhName: , expirationDate: expirationDate ? new Date(expirationDate).toLocaleString() : '-', status: d.status.map(s => : - d.status.includes('redemption period') ? : - d.status.includes('pending delete') ? : null - }>{punycode.toUnicode(d.ldhName)}), + domains: watchlist.domains.map(d => ), events: watchlist.triggers?.filter(t => t.action === 'email') .map(t => diff --git a/assets/pages/search/DomainSearchPage.tsx b/assets/pages/search/DomainSearchPage.tsx index f5be277..c30585c 100644 --- a/assets/pages/search/DomainSearchPage.tsx +++ b/assets/pages/search/DomainSearchPage.tsx @@ -1,4 +1,4 @@ -import React, {useState} from "react"; +import React, {useEffect, useState} from "react"; import {Empty, Flex, FormProps, message, Skeleton} from "antd"; import {Domain, getDomain} from "../../utils/api"; import {AxiosError} from "axios" @@ -6,11 +6,14 @@ import {t} from 'ttag' import {DomainSearchBar, FieldType} from "../../components/search/DomainSearchBar"; import {DomainResult} from "../../components/search/DomainResult"; import {showErrorAPI} from "../../utils/functions/showErrorAPI"; +import {useParams} from "react-router-dom"; export default function DomainSearchPage() { const [domain, setDomain] = useState() const [messageApi, contextHolder] = message.useMessage() + const {query} = useParams() + const onFinish: FormProps['onFinish'] = (values) => { setDomain(null) getDomain(values.ldhName).then(d => { @@ -22,6 +25,10 @@ export default function DomainSearchPage() { }) } + useEffect(() => { + if (query) onFinish({ldhName: query}) + }, [query]) + return {contextHolder} diff --git a/src/Service/RDAPService.php b/src/Service/RDAPService.php index a524aba..21bfaa5 100644 --- a/src/Service/RDAPService.php +++ b/src/Service/RDAPService.php @@ -83,7 +83,7 @@ readonly class RDAPService ]; /* @see https://www.iana.org/assignments/registrar-ids/registrar-ids.xhtml */ - public const ENTITY_IANA_RESERVED_IDS = [ + public const IANA_RESERVED_IDS = [ 1, 3, 8, 119, 365, 376, 9994, 9995, 9996, 9997, 9998, 9999, 10009, 4000001, 8888888, ]; @@ -509,7 +509,7 @@ readonly class RDAPService $entity->setHandle($rdapEntity['handle']); - if (array_key_exists('vcardArray', $rdapEntity) && !in_array($rdapEntity['handle'], self::ENTITY_IANA_RESERVED_IDS)) { + if (array_key_exists('vcardArray', $rdapEntity) && !in_array($rdapEntity['handle'], self::IANA_RESERVED_IDS)) { if (empty($entity->getJCard())) { $entity->setJCard($rdapEntity['vcardArray']); } else { @@ -524,7 +524,7 @@ readonly class RDAPService } } - if ($isIANAid || !array_key_exists('events', $rdapEntity) || in_array($rdapEntity['handle'], self::ENTITY_IANA_RESERVED_IDS)) { + if ($isIANAid || !array_key_exists('events', $rdapEntity) || in_array($rdapEntity['handle'], self::IANA_RESERVED_IDS)) { return $entity; } diff --git a/translations/translations.pot b/translations/translations.pot index 46dd0c0..53eab27 100644 --- a/translations/translations.pot +++ b/translations/translations.pot @@ -3,34 +3,34 @@ msgstr "" "Content-Type: text/plain; charset=utf-8\n" "Plural-Forms: nplurals=2; plural=(n!=1);\n" -#: assets/App.tsx:122 +#: assets/App.tsx:123 msgid "TOS" msgstr "" -#: assets/App.tsx:123 +#: assets/App.tsx:124 msgid "Privacy Policy" msgstr "" -#: assets/App.tsx:124 +#: assets/App.tsx:125 msgid "FAQ" msgstr "" -#: assets/App.tsx:127 +#: assets/App.tsx:128 msgid "Documentation" msgstr "" -#: assets/App.tsx:130 +#: assets/App.tsx:131 #, javascript-format msgid "" "${ ProjectLink } is an open source project distributed under the ${ " "LicenseLink } license." msgstr "" -#: assets/App.tsx:143 +#: assets/App.tsx:144 msgid "Official git repository" msgstr "" -#: assets/App.tsx:146 +#: assets/App.tsx:147 msgid "Submit an issue" msgstr "" @@ -123,7 +123,7 @@ msgid "Search" msgstr "" #: assets/components/Sider.tsx:39 -#: assets/components/tracking/watchlist/TrackedDomainTable.tsx:68 +#: assets/components/tracking/watchlist/TrackedDomainTable.tsx:69 msgid "Domain" msgstr "" @@ -367,54 +367,54 @@ msgstr "" msgid "Watchlist Entity Diagram" msgstr "" -#: assets/components/tracking/watchlist/diagram/watchlistToEdges.tsx:37 +#: assets/components/tracking/watchlist/diagram/watchlistToEdges.tsx:42 msgid "Registry" msgstr "" -#: assets/components/tracking/watchlist/diagram/watchlistToNodes.tsx:30 +#: assets/components/tracking/watchlist/diagram/watchlistToNodes.tsx:37 #, javascript-format msgid ".${ tld.tld } Registry" msgstr "" -#: assets/components/tracking/watchlist/TrackedDomainTable.tsx:14 +#: assets/components/tracking/watchlist/TrackedDomainTable.tsx:15 msgid "" "At least one domain name is in redemption period and will potentially be " "deleted soon" msgstr "" -#: assets/components/tracking/watchlist/TrackedDomainTable.tsx:19 +#: assets/components/tracking/watchlist/TrackedDomainTable.tsx:20 msgid "" "At least one domain name is pending deletion and will soon become available " "for registration again" msgstr "" -#: assets/components/tracking/watchlist/TrackedDomainTable.tsx:72 +#: assets/components/tracking/watchlist/TrackedDomainTable.tsx:73 msgid "Expiration date" msgstr "" -#: assets/components/tracking/watchlist/TrackedDomainTable.tsx:85 +#: assets/components/tracking/watchlist/TrackedDomainTable.tsx:86 msgid "Updated at" msgstr "" -#: assets/components/tracking/watchlist/TrackedDomainTable.tsx:92 +#: assets/components/tracking/watchlist/TrackedDomainTable.tsx:93 msgid "Status" msgstr "" -#: assets/components/tracking/watchlist/TrackedDomainTable.tsx:110 +#: assets/components/tracking/watchlist/TrackedDomainTable.tsx:111 msgid "No tracked domain names were found, please create your first Watchlist" msgstr "" -#: assets/components/tracking/watchlist/TrackedDomainTable.tsx:118 +#: assets/components/tracking/watchlist/TrackedDomainTable.tsx:119 msgid "" "Please note that this table does not include domain names marked as expired " "or those with an unknown expiration date" msgstr "" -#: assets/components/tracking/watchlist/TrackedDomainTable.tsx:122 +#: assets/components/tracking/watchlist/TrackedDomainTable.tsx:123 msgid "At least one domain name you are tracking requires special attention" msgstr "" -#: assets/components/tracking/watchlist/TrackedDomainTable.tsx:127 +#: assets/components/tracking/watchlist/TrackedDomainTable.tsx:128 msgid "The domain names below are subject to special monitoring" msgstr "" @@ -515,11 +515,11 @@ msgstr "" msgid "Sorry, the page you visited does not exist." msgstr "" -#: assets/pages/search/DomainSearchPage.tsx:18 +#: assets/pages/search/DomainSearchPage.tsx:21 msgid "Found !" msgstr "" -#: assets/pages/search/DomainSearchPage.tsx:34 +#: assets/pages/search/DomainSearchPage.tsx:41 msgid "" "Although the domain exists in my database, it has been deleted from the " "WHOIS by its registrar."