Merge branch 'master' of github.com:maelgangloff/domain-watchdog

This commit is contained in:
Maël Gangloff
2025-02-18 01:46:10 +01:00
5 changed files with 23 additions and 10 deletions

View File

@@ -111,7 +111,7 @@ export default function StatisticsPage() {
<Card bordered={false}>
<Statistic
loading={stats === undefined}
title={`.${tld}`}
title={tld ? `.${tld}` : t`TLD`}
value={domain}
valueStyle={{color: 'darkorange'}}
/>

View File

@@ -170,18 +170,27 @@ readonly class RDAPService
return $domain;
}
private function getTld($domain): ?object
private function getTld($domain): Tld
{
if (!str_contains($domain, '.')) {
return $this->tldRepository->findOneBy(['tld' => '']);
$tldEntity = $this->tldRepository->findOneBy(['tld' => '']);
if (null == $tldEntity) {
throw new NotFoundHttpException('The requested TLD is not yet supported, please try again with another one');
}
return $tldEntity;
}
$lastDotPosition = strrpos($domain, '.');
if (false === $lastDotPosition) {
throw new BadRequestException('Domain must contain at least one dot');
}
$tld = strtolower(idn_to_ascii(substr($domain, $lastDotPosition + 1)));
$tldEntity = $this->tldRepository->findOneBy(['tld' => $tld]);
if (null === $tldEntity) {
throw new NotFoundHttpException('The requested TLD is not yet supported, please try again with another one');
}
@@ -611,19 +620,20 @@ readonly class RDAPService
{
foreach ($dnsRoot['services'] as $service) {
foreach ($service[0] as $tld) {
if ('' === $tld) {
if (null === $this->tldRepository->findOneBy(['tld' => $tld])) {
$this->em->persist((new Tld())->setTld('.')->setType(TldType::root));
$this->em->flush();
}
if ('' === $tld && null === $this->tldRepository->findOneBy(['tld' => $tld])) {
$this->em->persist((new Tld())->setTld('')->setType(TldType::root));
$this->em->flush();
}
$tldReference = $this->em->getReference(Tld::class, $tld);
foreach ($service[1] as $rdapServerUrl) {
$server = $this->rdapServerRepository->findOneBy(['tld' => $tldReference, 'url' => $rdapServerUrl]);
if (null === $server) {
$server = new RdapServer();
}
$server
->setTld($tldReference)
->setUrl($rdapServerUrl)

View File

@@ -185,7 +185,8 @@ msgstr "Domain"
msgid "Domain Finder"
msgstr "Domänenfinder"
#: assets/components/Sider.tsx:49 assets/pages/search/TldPage.tsx:79
#: assets/components/Sider.tsx:49 assets/pages/StatisticsPage.tsx:114
#: assets/pages/search/TldPage.tsx:79
msgid "TLD"
msgstr "TLD"

View File

@@ -187,7 +187,8 @@ msgstr "Domaine"
msgid "Domain Finder"
msgstr "Rechercher un domaine"
#: assets/components/Sider.tsx:49 assets/pages/search/TldPage.tsx:79
#: assets/components/Sider.tsx:49 assets/pages/StatisticsPage.tsx:114
#: assets/pages/search/TldPage.tsx:79
msgid "TLD"
msgstr "TLD"

View File

@@ -175,6 +175,7 @@ msgid "Domain Finder"
msgstr ""
#: assets/components/Sider.tsx:49
#: assets/pages/StatisticsPage.tsx:114
#: assets/pages/search/TldPage.tsx:79
msgid "TLD"
msgstr ""