Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<link rel="icon" type="image/svg+xml" href="/dl-logo.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
<title>DomainLookup</title>
</head>
<body>
<div id="root"></div>
Expand Down
Binary file added public/dl-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 7 additions & 1 deletion src/components/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
import { useCallback } from 'react';
import { Shortcut } from '../enums/Shortcut.enum';
import AppVersion from './AppVersion';
import ShortKeys from './ShortKeys';
import ThemeController from './ThemeController';
import { FaGithub } from 'react-icons/fa';

const Footer = () => {
const getCurrentYear = useCallback((): string => {
const date = new Date();
return date.getFullYear().toString();
}, []);

return (
<div className="mt-10">
<ShortKeys keys={Object.values(Shortcut)} />
<div className="flex items-center text-sm justify-around text-base-content">
<p>© 2024 Nikola Nenovski. All right reserved.</p>
<p>© {getCurrentYear()} Nikola Nenovski. All rights reserved.</p>
<div className="flex items-center gap-2 cursor-default">
<AppVersion />
<a
Expand Down
115 changes: 54 additions & 61 deletions src/components/WhoisTable.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,47 @@
import React from 'react';
import React, { useMemo } from 'react';
import { getDays } from '../helpers/getDays';
const WhoisTable: React.FC<{
// eslint-disable-next-line @typescript-eslint/no-explicit-any
content: Record<string, any> | undefined;
loading: boolean;
}> = ({ content, loading }) => {
const whoisRows = useMemo(() => {
if (!content?.result) return [];

const {
registrar,
name_servers,
creation_date,
expiration_date,
updated_date,
status,
dnssec,
} = content.result;

const transformedWhoisObj = {
Registrar: registrar,
Name_Servers: Array.isArray(name_servers)
? name_servers
: name_servers.substring(0, name_servers.indexOf(' ')),
Registered_On: new Date(creation_date).toLocaleDateString(),
Expires_On: `${new Date(expiration_date).toLocaleDateString()} (${getDays(
expiration_date
)} days)`,
Last_updated_On: new Date(updated_date).toLocaleDateString(),
Status: Array.isArray(status)
? status.map((s: string) => s.substring(0, s.indexOf(' ')))
: status.substring(0, status.indexOf(' ')),
DNSSEC: dnssec,
};

return Object.entries(transformedWhoisObj).map(
([key, value]: [string, string | string[]]) => ({
label: key.replace(/_/g, ' '),
value,
})
);
}, [content]);

return (
<div className="flex h-full lg:min-h-80 lg:max-h-96 flex-col break-words shadow-md p-4 rounded-lg cursor-default overflow-y-auto border border-neutral">
{loading ? (
Expand All @@ -13,71 +50,27 @@ const WhoisTable: React.FC<{
</div>
) : !content ? (
<div className="flex justify-center items-center h-full">
<p>Data could not be fetched.</p>
<p>Whois data could not be fetched.</p>
</div>
) : (
<table className="table table-xs">
<tbody>
<tr className="hover">
<th className="align-top">Registrar</th>
<td>{content?.result!.registrar}</td>
</tr>
<tr className="hover">
<th className="align-top">Name Servers</th>
<td>
<ul>
{content?.result!.name_servers.map(
(ns: string, idx: number) => (
<li key={idx}>{ns}</li>
)
{whoisRows.map(row => (
<tr className="hover">
<th className="align-top">{row.label}</th>
<td>
{Array.isArray(row.value) ? (
<ul>
{row.value.map((r: string, idx: number) => (
<li key={`${idx}-${r}`}>{r}</li>
))}
</ul>
) : (
row.value
)}
</ul>
</td>
</tr>
<tr className="hover">
<th className="align-top">Registered On</th>
<td>
{new Date(content?.result!.creation_date).toLocaleDateString()}
</td>
</tr>
<tr className="hover">
<th className="align-top">Expires On</th>
<td>
{new Date(
content?.result!.expiration_date
).toLocaleDateString()}{' '}
({getDays(content?.result!.expiration_date)} days)
</td>
</tr>
<tr className="hover">
<th className="align-top">Last updated On</th>
<td>
{new Date(content?.result!.updated_date).toLocaleDateString()}
</td>
</tr>
<tr className="hover">
<th className="align-top">Status</th>
<td>
{typeof content?.result!.status === 'string' ? (
<p>
{content?.result!.status.substring(
0,
content?.result!.status.indexOf(' ')
)}
</p>
) : (
<ul>
{content?.result!.status.map((row: string, idx: number) => (
<li key={idx}>{row.substring(0, row.indexOf(' '))}</li>
))}
</ul>
)}
</td>
</tr>
<tr className="hover">
<th className="align-top">DNSSEC</th>
<td>{content?.result!.dnssec}</td>
</tr>
</td>
</tr>
))}
</tbody>
</table>
)}
Expand Down
1 change: 1 addition & 0 deletions src/services/cdnCheck.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ export const isCdnActive = async (domain: string) => {
return response.data.data;
} catch (error) {
console.error(error);
return {};
}
};
4 changes: 2 additions & 2 deletions src/services/http/whois.get.endpoints.http
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ GET {{WHOIS_API_URL}}
# @import ./variables.http

GET {{WHOIS_API_URL}}
?domain=nikolanenovski.com
apikey:{{WHOIS_API_KEY}}
?domain=random.co.uk
apikey:{{WHOIS_API_KEY}}
1 change: 1 addition & 0 deletions src/services/wpCheck.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ export const isWordpressInstalled = async (domain: string) => {
return response.data.data;
} catch (error) {
console.error(error);
return { wordpressInstalled: false };
}
};
1 change: 1 addition & 0 deletions src/views/Results.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ const Results = () => {
setIsSslLoading(false);
}),
getDomainInfo(domain).then(data => {
console.log(data);
setWhoIsData(data);
setIsWhoisLoading(false);
}),
Expand Down
Loading