mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-18 10:15:41 +00:00
feat: add estimated days before WHOIS release
This commit is contained in:
parent
3605f88a7c
commit
18acd41b29
@ -97,6 +97,14 @@ export function TrackedDomainTable() {
|
||||
icon={<KeyOutlined/>}
|
||||
/>
|
||||
</Tooltip>
|
||||
{
|
||||
d.expiresInDays && <Tooltip title={t`Estimated number of days until release`}>
|
||||
<Tag bordered={false}
|
||||
color={d.expiresInDays <= 5 ? 'red' : d.expiresInDays <= 35 ? 'orange' : 'default'}>
|
||||
{t`J ${d.expiresInDays}`}
|
||||
</Tag>
|
||||
</Tooltip>
|
||||
}
|
||||
</Flex>
|
||||
}
|
||||
}))
|
||||
@ -116,13 +124,13 @@ export function TrackedDomainTable() {
|
||||
{
|
||||
title: t`Domain`,
|
||||
dataIndex: 'ldhName',
|
||||
width: '30%',
|
||||
width: '25%',
|
||||
align: 'left'
|
||||
},
|
||||
{
|
||||
title: t`Options`,
|
||||
dataIndex: 'options',
|
||||
width: '10%',
|
||||
width: '15%',
|
||||
},
|
||||
{
|
||||
title: t`Expiration date`,
|
||||
|
||||
@ -66,6 +66,7 @@ export interface Domain {
|
||||
deleted: boolean
|
||||
updatedAt: string
|
||||
delegationSigned: boolean
|
||||
expiresInDays?: number
|
||||
}
|
||||
|
||||
export interface User {
|
||||
|
||||
@ -121,6 +121,9 @@ class Domain
|
||||
#[Groups(['domain:item', 'domain:list'])]
|
||||
private ?bool $delegationSigned = null;
|
||||
|
||||
#[Groups(['domain:item', 'domain:list'])]
|
||||
private ?int $expiresInDays = null;
|
||||
|
||||
private const IMPORTANT_EVENTS = [EventAction::Deletion->value, EventAction::Expiration->value];
|
||||
private const IMPORTANT_STATUS = [
|
||||
'redemption period',
|
||||
@ -135,6 +138,8 @@ class Domain
|
||||
'server hold',
|
||||
];
|
||||
|
||||
private const DAY = 24 * 60 * 60;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->events = new ArrayCollection();
|
||||
@ -454,4 +459,41 @@ class Domain
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
private static function daysBetween(\DateTimeImmutable $start, \DateTimeImmutable $end): int
|
||||
{
|
||||
$interval = $start->diff($end);
|
||||
return $interval->invert ? -$interval->days : $interval->days;
|
||||
}
|
||||
|
||||
public function getExpiresInDays(): ?int
|
||||
{
|
||||
$now = new \DateTimeImmutable();
|
||||
$lastStatus = $this->getDomainStatuses()->last();
|
||||
|
||||
if ($lastStatus) {
|
||||
if (in_array('pending delete', $lastStatus->getAddStatus())) {
|
||||
return self::daysBetween($now, $lastStatus->getCreatedAt()->add(new \DateInterval('P5D')));
|
||||
}
|
||||
if (in_array('redemption period', $lastStatus->getAddStatus())) {
|
||||
return self::daysBetween($now, $lastStatus->getCreatedAt()->add(new \DateInterval('P35D')));
|
||||
}
|
||||
}
|
||||
|
||||
$expiredAt = null;
|
||||
$deletedAt = null;
|
||||
foreach ($this->getEvents() as $event) {
|
||||
$expiredAt = !$event->getDeleted() && 'expiration' === $event->getAction() ? $event->getDate() : $expiredAt;
|
||||
$deletedAt = !$event->getDeleted() && 'deletion' === $event->getAction() ? $event->getDate() : $deletedAt;
|
||||
}
|
||||
|
||||
if ($deletedAt) {
|
||||
return self::daysBetween($now, $deletedAt->add(new \DateInterval('P30D')));
|
||||
}
|
||||
if ($expiredAt) {
|
||||
return self::daysBetween($now, $expiredAt->add(new \DateInterval('P65D')));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -43,7 +43,7 @@ msgstr ""
|
||||
#: assets/components/LoginForm.tsx:58
|
||||
#: assets/components/RegisterForm.tsx:39
|
||||
#: assets/components/RegisterForm.tsx:47
|
||||
#: assets/components/search/DomainSearchBar.tsx:25
|
||||
#: assets/components/search/DomainSearchBar.tsx:28
|
||||
#: assets/components/tracking/connector/ConnectorForm.tsx:45
|
||||
#: assets/components/tracking/connector/ConnectorForm.tsx:72
|
||||
#: assets/components/tracking/connector/ConnectorForm.tsx:80
|
||||
@ -147,7 +147,7 @@ msgstr ""
|
||||
msgid "Entities"
|
||||
msgstr ""
|
||||
|
||||
#: assets/components/search/DomainSearchBar.tsx:28
|
||||
#: assets/components/search/DomainSearchBar.tsx:31
|
||||
#: assets/components/tracking/watchlist/WatchlistForm.tsx:128
|
||||
msgid "This domain name does not appear to be valid"
|
||||
msgstr ""
|
||||
@ -161,7 +161,7 @@ msgid "Search"
|
||||
msgstr ""
|
||||
|
||||
#: assets/components/Sider.tsx:41
|
||||
#: assets/components/tracking/watchlist/TrackedDomainTable.tsx:117
|
||||
#: assets/components/tracking/watchlist/TrackedDomainTable.tsx:125
|
||||
msgid "Domain"
|
||||
msgstr ""
|
||||
|
||||
@ -425,37 +425,46 @@ msgid ""
|
||||
"for registration again"
|
||||
msgstr ""
|
||||
|
||||
#: assets/components/tracking/watchlist/TrackedDomainTable.tsx:123
|
||||
#: assets/components/tracking/watchlist/TrackedDomainTable.tsx:101
|
||||
msgid "Estimated number of days until release"
|
||||
msgstr ""
|
||||
|
||||
#: assets/components/tracking/watchlist/TrackedDomainTable.tsx:104
|
||||
#, javascript-format
|
||||
msgid "J ${ d.expiresInDays }"
|
||||
msgstr ""
|
||||
|
||||
#: assets/components/tracking/watchlist/TrackedDomainTable.tsx:131
|
||||
msgid "Options"
|
||||
msgstr ""
|
||||
|
||||
#: assets/components/tracking/watchlist/TrackedDomainTable.tsx:128
|
||||
#: assets/components/tracking/watchlist/TrackedDomainTable.tsx:136
|
||||
msgid "Expiration date"
|
||||
msgstr ""
|
||||
|
||||
#: assets/components/tracking/watchlist/TrackedDomainTable.tsx:141
|
||||
#: assets/components/tracking/watchlist/TrackedDomainTable.tsx:149
|
||||
msgid "Updated at"
|
||||
msgstr ""
|
||||
|
||||
#: assets/components/tracking/watchlist/TrackedDomainTable.tsx:148
|
||||
#: assets/components/tracking/watchlist/TrackedDomainTable.tsx:156
|
||||
msgid "Status"
|
||||
msgstr ""
|
||||
|
||||
#: assets/components/tracking/watchlist/TrackedDomainTable.tsx:168
|
||||
#: assets/components/tracking/watchlist/TrackedDomainTable.tsx:176
|
||||
msgid "No tracked domain names were found, please create your first Watchlist"
|
||||
msgstr ""
|
||||
|
||||
#: assets/components/tracking/watchlist/TrackedDomainTable.tsx:177
|
||||
#: assets/components/tracking/watchlist/TrackedDomainTable.tsx:185
|
||||
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:182
|
||||
#: assets/components/tracking/watchlist/TrackedDomainTable.tsx:190
|
||||
msgid "At least one domain name you are tracking requires special attention"
|
||||
msgstr ""
|
||||
|
||||
#: assets/components/tracking/watchlist/TrackedDomainTable.tsx:188
|
||||
#: assets/components/tracking/watchlist/TrackedDomainTable.tsx:196
|
||||
msgid "The domain names below are subject to special monitoring"
|
||||
msgstr ""
|
||||
|
||||
@ -554,11 +563,11 @@ msgstr ""
|
||||
msgid "Sorry, the page you visited does not exist."
|
||||
msgstr ""
|
||||
|
||||
#: assets/pages/search/DomainSearchPage.tsx:30
|
||||
#: assets/pages/search/DomainSearchPage.tsx:32
|
||||
msgid "Found !"
|
||||
msgstr ""
|
||||
|
||||
#: assets/pages/search/DomainSearchPage.tsx:53
|
||||
#: assets/pages/search/DomainSearchPage.tsx:55
|
||||
msgid ""
|
||||
"Although the domain exists in my database, it has been deleted from the "
|
||||
"WHOIS by its registrar."
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user