diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..b58b51e Binary files /dev/null and b/.DS_Store differ diff --git a/index.html b/index.html index e0d1c84..b1011ad 100644 --- a/index.html +++ b/index.html @@ -2,9 +2,9 @@ - + - Vite + React + TS + DomainLookup
diff --git a/public/dl-logo.png b/public/dl-logo.png new file mode 100644 index 0000000..c271033 Binary files /dev/null and b/public/dl-logo.png differ diff --git a/src/components/Footer.tsx b/src/components/Footer.tsx index a527e1a..983326d 100644 --- a/src/components/Footer.tsx +++ b/src/components/Footer.tsx @@ -1,3 +1,4 @@ +import { useCallback } from 'react'; import { Shortcut } from '../enums/Shortcut.enum'; import AppVersion from './AppVersion'; import ShortKeys from './ShortKeys'; @@ -5,11 +6,16 @@ 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 (
-

© 2024 Nikola Nenovski. All right reserved.

+

© {getCurrentYear()} Nikola Nenovski. All rights reserved.

| 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 (
{loading ? ( @@ -13,71 +50,27 @@ const WhoisTable: React.FC<{
) : !content ? (
-

Data could not be fetched.

+

Whois data could not be fetched.

) : ( - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - + + + ))}
Registrar{content?.result!.registrar}
Name Servers -
    - {content?.result!.name_servers.map( - (ns: string, idx: number) => ( -
  • {ns}
  • - ) + {whoisRows.map(row => ( +
{row.label} + {Array.isArray(row.value) ? ( +
    + {row.value.map((r: string, idx: number) => ( +
  • {r}
  • + ))} +
+ ) : ( + row.value )} - -
Registered On - {new Date(content?.result!.creation_date).toLocaleDateString()} -
Expires On - {new Date( - content?.result!.expiration_date - ).toLocaleDateString()}{' '} - ({getDays(content?.result!.expiration_date)} days) -
Last updated On - {new Date(content?.result!.updated_date).toLocaleDateString()} -
Status - {typeof content?.result!.status === 'string' ? ( -

- {content?.result!.status.substring( - 0, - content?.result!.status.indexOf(' ') - )} -

- ) : ( -
    - {content?.result!.status.map((row: string, idx: number) => ( -
  • {row.substring(0, row.indexOf(' '))}
  • - ))} -
- )} -
DNSSEC{content?.result!.dnssec}
)} diff --git a/src/services/cdnCheck.service.ts b/src/services/cdnCheck.service.ts index cb1d140..265d6c4 100644 --- a/src/services/cdnCheck.service.ts +++ b/src/services/cdnCheck.service.ts @@ -14,5 +14,6 @@ export const isCdnActive = async (domain: string) => { return response.data.data; } catch (error) { console.error(error); + return {}; } }; diff --git a/src/services/http/whois.get.endpoints.http b/src/services/http/whois.get.endpoints.http index f6fb4e8..fc57081 100644 --- a/src/services/http/whois.get.endpoints.http +++ b/src/services/http/whois.get.endpoints.http @@ -18,5 +18,5 @@ GET {{WHOIS_API_URL}} # @import ./variables.http GET {{WHOIS_API_URL}} - ?domain=nikolanenovski.com - apikey:{{WHOIS_API_KEY}} \ No newline at end of file + ?domain=random.co.uk + apikey:{{WHOIS_API_KEY}} diff --git a/src/services/wpCheck.service.ts b/src/services/wpCheck.service.ts index 08c2ef9..e3df0bf 100644 --- a/src/services/wpCheck.service.ts +++ b/src/services/wpCheck.service.ts @@ -14,5 +14,6 @@ export const isWordpressInstalled = async (domain: string) => { return response.data.data; } catch (error) { console.error(error); + return { wordpressInstalled: false }; } }; diff --git a/src/views/Results.tsx b/src/views/Results.tsx index 8ff7d64..e6b76cc 100644 --- a/src/views/Results.tsx +++ b/src/views/Results.tsx @@ -66,6 +66,7 @@ const Results = () => { setIsSslLoading(false); }), getDomainInfo(domain).then(data => { + console.log(data); setWhoIsData(data); setIsWhoisLoading(false); }),