Skip to content

Commit

Permalink
Updates the internal/external content links section
Browse files Browse the repository at this point in the history
  • Loading branch information
Lissy93 committed Jul 29, 2023
1 parent f41951a commit d6da8e1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
12 changes: 12 additions & 0 deletions api/content-links.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@ exports.handler = async (event, context) => {
const internalLinks = [...internalLinksMap.entries()].sort((a, b) => b[1] - a[1]).map(entry => entry[0]);
const externalLinks = [...externalLinksMap.entries()].sort((a, b) => b[1] - a[1]).map(entry => entry[0]);

if (internalLinks.length === 0 && externalLinks.length === 0) {
return {
statusCode: 400,
body: JSON.stringify({
skipped: 'No internal or external links found. '
+ 'This may be due to the website being dynamically rendered, using a client-side framework (like React), and without SSR enabled. '
+ 'That would mean that the static HTML returned from the HTTP request doesn\'t contain any meaningful content for Web-Check to analyze. '
+ 'You can rectify this by using a headless browser to render the page instead.',
}),
};
}

return {
statusCode: 200,
body: JSON.stringify({ internal: internalLinks, external: externalLinks }),
Expand Down
16 changes: 2 additions & 14 deletions src/components/Results/ContentLinks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,8 @@ const getPathName = (link: string) => {
};

const ContentLinksCard = (props: { data: any, title: string, actionButtons: any }): JSX.Element => {
const { internal, external} = props.data;
console.log('Internal Links', internal);
console.log('External Links', external);
const internal = props.data.internal || [];
const external = props.data.external || [];
return (
<Card heading={props.title} actionButtons={props.actionButtons} styles={cardStyles}>
<Heading as="h3" size="small" color={colors.primary}>Summary</Heading>
Expand All @@ -71,17 +70,6 @@ const ContentLinksCard = (props: { data: any, title: string, actionButtons: any
))}
</details>
)}
{/* {portData.openPorts.map((port: any) => (
<Row key={port} lbl="" val="">
<span>{port}</span>
</Row>
)
)}
<br />
<small>
Unable to establish connections to:<br />
{portData.failedPorts.join(', ')}
</small> */}
</Card>
);
}
Expand Down

0 comments on commit d6da8e1

Please sign in to comment.