diff --git a/website/src/components/report/App.tsx b/website/src/components/report/App.tsx index e8ce4ea..74a4d29 100644 --- a/website/src/components/report/App.tsx +++ b/website/src/components/report/App.tsx @@ -84,7 +84,7 @@ export function TabShowHostDetails({
{host.caseOf({ Nothing: () =>
Choose a host to view details.
, - Just: (x) => , + Just: (x) => , })}
diff --git a/website/src/components/report/ShowHostDetails.tsx b/website/src/components/report/ShowHostDetails.tsx index ddfdd52..4359020 100644 --- a/website/src/components/report/ShowHostDetails.tsx +++ b/website/src/components/report/ShowHostDetails.tsx @@ -1,4 +1,4 @@ -import { LhpHostReport } from '@/lib/data'; +import { LhpHostReport, LhpPatrolReport } from '@/lib/data'; import { Card, CardBody, CardHeader } from '@nextui-org/card'; import { Chip } from '@nextui-org/chip'; import { Listbox, ListboxItem } from '@nextui-org/listbox'; @@ -6,7 +6,10 @@ import Link from 'next/link'; import { toast } from 'react-toastify'; import { KVBox } from '../helpers'; -export function ShowHostDetails({ host }: { host: LhpHostReport }) { +export function ShowHostDetails({ host, data }: { host: LhpHostReport; data: LhpPatrolReport }) { + const authorizedKeysPlanned = [...(data.knownSshKeys || []), ...(host.host.knownSshKeys || [])]; + const authorizedKeysPlannedSet = new Set(authorizedKeysPlanned.map((x) => x.fingerprint)); + return (

@@ -87,12 +90,39 @@ export function ShowHostDetails({ host }: { host: LhpHostReport }) {

- Authorized SSH Keys + Authorized SSH Keys Found No authorized SSH keys are found. Sounds weird?} + > + {({ length, type, fingerprint, data, comment }) => ( + 🟢 : <>🔴} + onPress={() => { + navigator.clipboard.writeText(data); + toast('SSH Key is copied to clipboard.'); + }} + > + {`${type} (${length}) - ${fingerprint} - ${comment || ''}`} + + )} + + + + + + Authorized SSH Keys Planned + + + No authorized SSH keys are found as planned. Sounds weird? + } > {({ length, type, fingerprint, data, comment }) => ( = data.knownSshKeys.reduce( - (acc, x) => ({ ...acc, [x.fingerprint]: x.comment || '' }), - {} - ); + const knownComments: Record = [ + ...data.knownSshKeys, + ...data.hosts.reduce((acc, x) => [...acc, ...(x.host.knownSshKeys || [])], [] as typeof data.knownSshKeys), + ].reduce((acc, x) => ({ ...acc, [x.fingerprint]: x.comment || '' }), {}); // Iterate over all SSH public keys for all hosts and populate our registry: for (const host of data.hosts) {