diff --git a/website/README.md b/website/README.md index 1dd2d76..b9b05cc 100644 --- a/website/README.md +++ b/website/README.md @@ -1,4 +1,4 @@ -# lhpui +# Host Patrol Website ## Getting Started diff --git a/website/next.config.mjs b/website/next.config.mjs index d0d567c..7779f2f 100644 --- a/website/next.config.mjs +++ b/website/next.config.mjs @@ -1,6 +1,6 @@ /** @type {import('next').NextConfig} */ const nextConfig = { - basePath: '/lhp', + basePath: '/hostpatrol', output: 'export', images: { unoptimized: true, diff --git a/website/package-lock.json b/website/package-lock.json index 56cffcc..ac3f271 100644 --- a/website/package-lock.json +++ b/website/package-lock.json @@ -1,11 +1,11 @@ { - "name": "lhpui", + "name": "hostpatrol-website", "version": "0.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "lhpui", + "name": "hostpatrol-website", "version": "0.0.0", "dependencies": { "@nextui-org/react": "^2.2.10", diff --git a/website/package.json b/website/package.json index e8c8b8f..bd7ac05 100644 --- a/website/package.json +++ b/website/package.json @@ -1,5 +1,5 @@ { - "name": "lhpui", + "name": "hostpatrol-website", "version": "0.0.0", "private": true, "scripts": { diff --git a/website/src/app/layout.tsx b/website/src/app/layout.tsx index 095714c..c859a8a 100644 --- a/website/src/app/layout.tsx +++ b/website/src/app/layout.tsx @@ -9,8 +9,8 @@ import { Providers } from './providers'; const font = JetBrains_Mono({ subsets: ['latin'] }); export const metadata: Metadata = { - title: 'lhp', - description: "Lazy Hacker's Linux Host Patrol", + title: 'Host Patrol', + description: "Lazy Hacker's Host Patrol", }; export default function RootLayout({ diff --git a/website/src/components/header.tsx b/website/src/components/header.tsx index de4deae..5a2f836 100644 --- a/website/src/components/header.tsx +++ b/website/src/components/header.tsx @@ -24,11 +24,14 @@ export default function Header() { classNames={{ base: 'z-50 bg-gray-200' }} > -

lhp

+

+ HOST + PATROL +

- Lazy Hacker's Linux Host Patrol + Lazy Hacker's Host Patrol @@ -45,7 +48,7 @@ export default function Header() { - + GitHub @@ -67,7 +70,7 @@ export default function Header() { - + GitHub diff --git a/website/src/components/report/App.tsx b/website/src/components/report/App.tsx index 74a4d29..833b7d1 100644 --- a/website/src/components/report/App.tsx +++ b/website/src/components/report/App.tsx @@ -1,4 +1,4 @@ -import { LhpHostReport, LhpPatrolReport, buildSshKeysTable } from '@/lib/data'; +import { HostPatrolReport, HostReport, buildSshKeysTable } from '@/lib/data'; import { Tab, Tabs } from '@nextui-org/react'; import { Just, Maybe, Nothing } from 'purify-ts/Maybe'; import { useEffect, useState } from 'react'; @@ -8,8 +8,8 @@ import { TabOverview } from './TabOverview'; import { TabulateHosts } from './TabulateHosts'; import { TabulateSshKeys } from './TabulateSshKeys'; -export function App({ data, onFlushRequest }: { data: LhpPatrolReport; onFlushRequest: () => void }) { - const [host, setHost] = useState>(Nothing); +export function App({ data, onFlushRequest }: { data: HostPatrolReport; onFlushRequest: () => void }) { + const [host, setHost] = useState>(Nothing); type TabKey = 'overview' | 'tabulate-hosts' | 'show-host-details' | 'ssh-keys' | 'flush'; const [tab, setTab] = useState('overview'); @@ -60,8 +60,8 @@ export function TabTabulateHosts({ data, setHost, }: { - data: LhpPatrolReport; - setHost: (x: Maybe) => void; + data: HostPatrolReport; + setHost: (x: Maybe) => void; }) { return setHost(Just(x))} />; } @@ -71,9 +71,9 @@ export function TabShowHostDetails({ host, setHost, }: { - data: LhpPatrolReport; - host: Maybe; - setHost: (x: Maybe) => void; + data: HostPatrolReport; + host: Maybe; + setHost: (x: Maybe) => void; }) { return (
@@ -91,6 +91,6 @@ export function TabShowHostDetails({ ); } -export function TabSshKeys({ data }: { data: LhpPatrolReport }) { +export function TabSshKeys({ data }: { data: HostPatrolReport }) { return ; } diff --git a/website/src/components/report/DataLoader.tsx b/website/src/components/report/DataLoader.tsx index 6716216..bd19f44 100644 --- a/website/src/components/report/DataLoader.tsx +++ b/website/src/components/report/DataLoader.tsx @@ -1,10 +1,10 @@ -import { LhpPatrolReport, parseData, saveData } from '@/lib/data'; +import { HostPatrolReport, parseData, saveData } from '@/lib/data'; import { Card, CardBody, CardFooter, CardHeader } from '@nextui-org/card'; import { Divider } from '@nextui-org/divider'; import { ChangeEvent, useState } from 'react'; import { Centered } from '../helpers'; -export function DataLoader({ onLoadData }: { onLoadData: (x: LhpPatrolReport) => void }) { +export function DataLoader({ onLoadData }: { onLoadData: (x: HostPatrolReport) => void }) { const [error, setError] = useState(); const changeHandler = (e: ChangeEvent) => { diff --git a/website/src/components/report/ShowHostDetails.tsx b/website/src/components/report/ShowHostDetails.tsx index 01cb439..db51c6d 100644 --- a/website/src/components/report/ShowHostDetails.tsx +++ b/website/src/components/report/ShowHostDetails.tsx @@ -1,4 +1,4 @@ -import { LhpHostReport, LhpPatrolReport, SshPublicKey } from '@/lib/data'; +import { HostPatrolReport, HostReport, SshPublicKey } from '@/lib/data'; import { Card, CardBody, @@ -18,7 +18,7 @@ import Link from 'next/link'; import { toast } from 'react-toastify'; import { KVBox } from '../helpers'; -export function ShowHostDetails({ host, data }: { host: LhpHostReport; data: LhpPatrolReport }) { +export function ShowHostDetails({ host, data }: { host: HostReport; data: HostPatrolReport }) { return (

@@ -212,7 +212,7 @@ export function ShowHostDetails({ host, data }: { host: LhpHostReport; data: Lhp ); } -export function TabulateSshKeys({ host, data }: { host: LhpHostReport; data: LhpPatrolReport }) { +export function TabulateSshKeys({ host, data }: { host: HostReport; data: HostPatrolReport }) { const keysKnownGlobal = (data.knownSshKeys || []).reduce( (acc, x) => ({ ...acc, [`${x.fingerprint}`]: x }), {} as Record diff --git a/website/src/components/report/Sidebar.tsx b/website/src/components/report/Sidebar.tsx index 5aa3cb1..9858b11 100644 --- a/website/src/components/report/Sidebar.tsx +++ b/website/src/components/report/Sidebar.tsx @@ -1,11 +1,11 @@ -import { LhpHostReport } from '@/lib/data'; +import { HostReport } from '@/lib/data'; import { Listbox, ListboxItem } from '@nextui-org/listbox'; import Image from 'next/image'; import { getCloudIconName } from './helpers'; export interface SidebarProps { - data: LhpHostReport[]; - onHostSelect: (host: LhpHostReport) => void; + data: HostReport[]; + onHostSelect: (host: HostReport) => void; } export function Sidebar({ data, onHostSelect }: SidebarProps) { diff --git a/website/src/components/report/TabOverview.tsx b/website/src/components/report/TabOverview.tsx index aac1059..b4734b0 100644 --- a/website/src/components/report/TabOverview.tsx +++ b/website/src/components/report/TabOverview.tsx @@ -1,7 +1,7 @@ -import { LhpPatrolReport, buildSshKeysTable } from '@/lib/data'; +import { HostPatrolReport, buildSshKeysTable } from '@/lib/data'; import { SimpleBarChart, histogram } from '../helpers'; -export function TabOverview({ data }: { data: LhpPatrolReport }) { +export function TabOverview({ data }: { data: HostPatrolReport }) { const sshkeys = Object.values(buildSshKeysTable(data)); return ( diff --git a/website/src/components/report/TabulateHosts.tsx b/website/src/components/report/TabulateHosts.tsx index b4c9c86..2e87839 100644 --- a/website/src/components/report/TabulateHosts.tsx +++ b/website/src/components/report/TabulateHosts.tsx @@ -1,4 +1,4 @@ -import { LhpHostReport } from '@/lib/data'; +import { HostReport } from '@/lib/data'; import { Chip } from '@nextui-org/chip'; import { Radio, RadioGroup, Select, SelectItem, Selection, Slider } from '@nextui-org/react'; import { Table, TableBody, TableCell, TableColumn, TableHeader, TableRow } from '@nextui-org/table'; @@ -11,11 +11,11 @@ export function TabulateHosts({ hosts, onHostSelect, }: { - hosts: LhpHostReport[]; - onHostSelect: (host: LhpHostReport) => void; + hosts: HostReport[]; + onHostSelect: (host: HostReport) => void; }) { - const [filters, setFilters] = useState boolean>>({}); - const [filteredHosts, setFilteredHosts] = useState(hosts); + const [filters, setFilters] = useState boolean>>({}); + const [filteredHosts, setFilteredHosts] = useState(hosts); useEffect(() => { setFilteredHosts(hosts.filter((host) => Object.values(filters).reduce((acc, f) => acc && f(host), true))); diff --git a/website/src/components/report/index.tsx b/website/src/components/report/index.tsx index 0e27e1f..9d54ada 100644 --- a/website/src/components/report/index.tsx +++ b/website/src/components/report/index.tsx @@ -1,6 +1,6 @@ 'use client'; -import { LhpPatrolReport, deleteData, loadData } from '@/lib/data'; +import { HostPatrolReport, deleteData, loadData } from '@/lib/data'; import { Just, Maybe, Nothing } from 'purify-ts/Maybe'; import { useEffect, useState } from 'react'; import { BigSpinner } from '../helpers'; @@ -8,7 +8,7 @@ import { App } from './App'; import { DataLoader } from './DataLoader'; export function Report() { - const [data, setAppData] = useState>>(Nothing); + const [data, setAppData] = useState>>(Nothing); useEffect(() => { loadData().caseOf({ diff --git a/website/src/lib/data.ts b/website/src/lib/data.ts index f243890..018d5fb 100644 --- a/website/src/lib/data.ts +++ b/website/src/lib/data.ts @@ -4,7 +4,7 @@ import { FromSchema } from 'json-schema-to-ts'; import { Either, Left, Right } from 'purify-ts/Either'; import { Just, Maybe, Nothing } from 'purify-ts/Maybe'; -export const LHP_PATROL_REPORT_SCHEMA = { +export const HOSTPATROL_REPORT_SCHEMA = { $comment: 'Host Patrol Report\nReport', properties: { hosts: { @@ -262,22 +262,22 @@ export const LHP_PATROL_REPORT_SCHEMA = { type: 'object', } as const satisfies JSONSchema; -export type LhpPatrolReport = FromSchema; +export type HostPatrolReport = FromSchema; export type ArrayElement = ArrayType extends readonly (infer ElementType)[] ? ElementType : never; -export type LhpHostReport = ArrayElement; -export type SshPublicKey = ArrayElement; +export type HostReport = ArrayElement; +export type SshPublicKey = ArrayElement; const AJV = new Ajv(); -const LHP_PATROL_REPORT_VALIDATOR = AJV.compile(LHP_PATROL_REPORT_SCHEMA); +const HOSTPATROL_REPORT_VALIDATOR = AJV.compile(HOSTPATROL_REPORT_SCHEMA); -const _LOCAL_STORAGE_KEY_DATA = 'LHP_DATA'; +const _LOCAL_STORAGE_KEY_DATA = 'HOSTPATROL_DATA'; -export function loadData(): Either> { +export function loadData(): Either> { const data = localStorage.getItem(_LOCAL_STORAGE_KEY_DATA); if (data === null) { @@ -287,14 +287,14 @@ export function loadData(): Either> { return parseData(data).map(Just); } -export function parseData(data: string): Either { +export function parseData(data: string): Either { try { const parsed = JSON.parse(data); - const result = LHP_PATROL_REPORT_VALIDATOR(parsed); + const result = HOSTPATROL_REPORT_VALIDATOR(parsed); if (!result) { - console.error(LHP_PATROL_REPORT_VALIDATOR.errors); - return Left('Invalid lhp patrol report object.'); + console.error(HOSTPATROL_REPORT_VALIDATOR.errors); + return Left('Invalid Host Patrol report object.'); } return Right(parsed); @@ -303,7 +303,7 @@ export function parseData(data: string): Either { } } -export function saveData(x: LhpPatrolReport): void { +export function saveData(x: HostPatrolReport): void { localStorage.setItem(_LOCAL_STORAGE_KEY_DATA, JSON.stringify(x)); } @@ -315,13 +315,13 @@ export type SshKeysTable = Record; export interface SshKeysTableRecord { key: SshPublicKey; - seenHosts: Set; + seenHosts: Set; seenComments: Set; isKnown: boolean; knownComment: string; } -export function buildSshKeysTable(data: LhpPatrolReport): SshKeysTable { +export function buildSshKeysTable(data: HostPatrolReport): SshKeysTable { // Initialize the return value: const keys: SshKeysTable = {};