diff --git a/netlify.toml b/netlify.toml index 432f87b..7e87c53 100644 --- a/netlify.toml +++ b/netlify.toml @@ -129,6 +129,11 @@ to = "/.netlify/functions/sitemap" status = 301 force = true +[[redirects]] + from = "/screenshot" + to = "/.netlify/functions/screenshot" + status = 301 + force = true # For router history mode, ensure pages land on index [[redirects]] diff --git a/src/components/Results/Screenshot.tsx b/src/components/Results/Screenshot.tsx index 5fbe346..6b1bfa7 100644 --- a/src/components/Results/Screenshot.tsx +++ b/src/components/Results/Screenshot.tsx @@ -11,11 +11,12 @@ const cardStyles = ` } `; -const ScreenshotCard = (props: { data: { data: string }, title: string, actionButtons: any }): JSX.Element => { +const ScreenshotCard = (props: { data: { image?: string, data?: string, }, title: string, actionButtons: any }): JSX.Element => { const screenshot = props.data; return ( - Full page screenshot + { screenshot.image && Full page screenshot } + { (!screenshot.image && screenshot.data) && Full page screenshot } ); } diff --git a/src/pages/Results.tsx b/src/pages/Results.tsx index 83686b8..7f5d383 100644 --- a/src/pages/Results.tsx +++ b/src/pages/Results.tsx @@ -236,7 +236,7 @@ const Results = (): JSX.Element => { // Fetch and parse Lighthouse performance data const [lighthouseResults, updateLighthouseResults] = useMotherHook({ - jobId: 'lighthouse', + jobId: 'quality', updateLoadingJobs, addressInfo: { address, addressType, expectedAddressTypes: urlTypeOnly }, fetchRequest: () => fetch(`/lighthouse-report?url=${address}`) @@ -349,6 +349,14 @@ const Results = (): JSX.Element => { fetchRequest: () => fetch(`/sitemap?url=${address}`).then(res => parseJson(res)), }); + // Get a websites listed pages, from sitemap + const [screenshotResult, updateScreenshotResult] = useMotherHook({ + jobId: 'screenshot', + updateLoadingJobs, + addressInfo: { address, addressType, expectedAddressTypes: urlTypeOnly }, + fetchRequest: () => fetch(`/screenshot?url=${address}`).then(res => parseJson(res)), + }); + // Get site features from BuiltWith const [siteFeaturesResults, updateSiteFeaturesResults] = useMotherHook({ jobId: 'features', @@ -374,7 +382,7 @@ const Results = (): JSX.Element => { // Run a manual whois lookup on the domain const [domainLookupResults, updateDomainLookupResults] = useMotherHook({ - jobId: 'domain-lookup', + jobId: 'domain', updateLoadingJobs, addressInfo: { address, addressType, expectedAddressTypes: urlTypeOnly }, fetchRequest: () => fetch(`/whois-lookup?url=${address}`).then(res => parseJson(res)), @@ -430,7 +438,8 @@ const Results = (): JSX.Element => { { id: 'dnssec', title: 'DNSSEC', result: dnsSecResults, Component: DnsSecCard, refresh: updateDnsSecResults }, { id: 'status', title: 'Server Status', result: serverStatusResults, Component: ServerStatusCard, refresh: updateServerStatusResults }, { id: 'ports', title: 'Open Ports', result: portsResults, Component: OpenPortsCard, refresh: updatePortsResults }, - { id: 'screenshot', title: 'Screenshot', result: lighthouseResults?.fullPageScreenshot?.screenshot, Component: ScreenshotCard, refresh: updateLighthouseResults }, + { id: 'screenshot', title: 'Screenshot', result: screenshotResult, Component: ScreenshotCard, refresh: updateScreenshotResult }, + // { id: 'screenshot', title: 'Screenshot', result: lighthouseResults?.fullPageScreenshot?.screenshot, Component: ScreenshotCard, refresh: updateLighthouseResults }, { id: 'txt-records', title: 'TXT Records', result: txtRecordResults, Component: TxtRecordCard, refresh: updateTxtRecordResults }, { id: 'hsts', title: 'HSTS Check', result: hstsResults, Component: HstsCard, refresh: updateHstsResults }, { id: 'whois', title: 'Domain Info', result: whoIsResults, Component: WhoIsCard, refresh: updateWhoIsResults },