mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-17 17:55:42 +00:00
fix: tld fetch and stats display
This commit is contained in:
parent
05a7ec9a82
commit
54d9b9dd19
@ -111,7 +111,7 @@ export default function StatisticsPage() {
|
|||||||
<Card bordered={false}>
|
<Card bordered={false}>
|
||||||
<Statistic
|
<Statistic
|
||||||
loading={stats === undefined}
|
loading={stats === undefined}
|
||||||
title={`.${tld}`}
|
title={tld ? `.${tld}` : t`TLD`}
|
||||||
value={domain}
|
value={domain}
|
||||||
valueStyle={{color: 'darkorange'}}
|
valueStyle={{color: 'darkorange'}}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@ -173,15 +173,24 @@ readonly class RDAPService
|
|||||||
private function getTld($domain): ?object
|
private function getTld($domain): ?object
|
||||||
{
|
{
|
||||||
if (!str_contains($domain, '.')) {
|
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, '.');
|
$lastDotPosition = strrpos($domain, '.');
|
||||||
|
|
||||||
if (false === $lastDotPosition) {
|
if (false === $lastDotPosition) {
|
||||||
throw new BadRequestException('Domain must contain at least one dot');
|
throw new BadRequestException('Domain must contain at least one dot');
|
||||||
}
|
}
|
||||||
|
|
||||||
$tld = strtolower(idn_to_ascii(substr($domain, $lastDotPosition + 1)));
|
$tld = strtolower(idn_to_ascii(substr($domain, $lastDotPosition + 1)));
|
||||||
$tldEntity = $this->tldRepository->findOneBy(['tld' => $tld]);
|
$tldEntity = $this->tldRepository->findOneBy(['tld' => $tld]);
|
||||||
|
|
||||||
if (null === $tldEntity) {
|
if (null === $tldEntity) {
|
||||||
throw new NotFoundHttpException('The requested TLD is not yet supported, please try again with another one');
|
throw new NotFoundHttpException('The requested TLD is not yet supported, please try again with another one');
|
||||||
}
|
}
|
||||||
@ -610,19 +619,20 @@ readonly class RDAPService
|
|||||||
{
|
{
|
||||||
foreach ($dnsRoot['services'] as $service) {
|
foreach ($dnsRoot['services'] as $service) {
|
||||||
foreach ($service[0] as $tld) {
|
foreach ($service[0] as $tld) {
|
||||||
if ('' === $tld) {
|
if ('' === $tld && null === $this->tldRepository->findOneBy(['tld' => $tld])) {
|
||||||
if (null === $this->tldRepository->findOneBy(['tld' => $tld])) {
|
$this->em->persist((new Tld())->setTld('')->setType(TldType::root));
|
||||||
$this->em->persist((new Tld())->setTld('.')->setType(TldType::root));
|
$this->em->flush();
|
||||||
$this->em->flush();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$tldReference = $this->em->getReference(Tld::class, $tld);
|
$tldReference = $this->em->getReference(Tld::class, $tld);
|
||||||
|
|
||||||
foreach ($service[1] as $rdapServerUrl) {
|
foreach ($service[1] as $rdapServerUrl) {
|
||||||
$server = $this->rdapServerRepository->findOneBy(['tld' => $tldReference, 'url' => $rdapServerUrl]);
|
$server = $this->rdapServerRepository->findOneBy(['tld' => $tldReference, 'url' => $rdapServerUrl]);
|
||||||
|
|
||||||
if (null === $server) {
|
if (null === $server) {
|
||||||
$server = new RdapServer();
|
$server = new RdapServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
$server
|
$server
|
||||||
->setTld($tldReference)
|
->setTld($tldReference)
|
||||||
->setUrl($rdapServerUrl)
|
->setUrl($rdapServerUrl)
|
||||||
|
|||||||
@ -175,6 +175,7 @@ msgid "Domain Finder"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: assets/components/Sider.tsx:49
|
#: assets/components/Sider.tsx:49
|
||||||
|
#: assets/pages/StatisticsPage.tsx:114
|
||||||
#: assets/pages/search/TldPage.tsx:79
|
#: assets/pages/search/TldPage.tsx:79
|
||||||
msgid "TLD"
|
msgid "TLD"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user