Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various Fixes and Improvements #53

Merged
merged 5 commits into from
Apr 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ let
pkgs.nil
pkgs.nixpkgs-fmt
pkgs.nodePackages.prettier
pkgs.nodejs_20
pkgs.upx

## Our custom scripts:
Expand All @@ -128,6 +129,9 @@ let
binPaths = [
pkgs.bashInteractive ## Added for bash-based CLI option completions
];
nativeBuildInputs = [
pkgs.openssh ## Required by the application tests
];
};

############
Expand Down
6 changes: 3 additions & 3 deletions nix/sources.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
"homepage": null,
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "40d989164088db79c1895f177ee67216d91ae8a5",
"sha256": "149awch51367za8mjs2inx5m3jgijh9ibda1slf8gywc7lbalsaa",
"rev": "7644b4bc09c6329bcd82561a076fd7add697d092",
"sha256": "11ic5as26f82rcd71wag0n5p4aacb7cz4v3y3kw9p72nkv0i19wi",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/40d989164088db79c1895f177ee67216d91ae8a5.tar.gz",
"url": "https://github.com/NixOS/nixpkgs/archive/7644b4bc09c6329bcd82561a076fd7add697d092.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
}
}
4 changes: 4 additions & 0 deletions src/Lhp/Remote.hs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ instance Aeson.ToJSON LhpError where
-- * Internal


-- | Builds 'Z.Ssh.SshConfig' value from 'Types.Host'.
--
-- If the host does not have an SSH configuration, it will default to
-- an SSH configuration with the host name as the destination.
getHostSshConfig :: Types.Host -> Z.Ssh.SshConfig
getHostSshConfig Types.Host {..} =
fromMaybe Z.Ssh.SshConfig {_sshConfigDestination = _hostName, _sshConfigOptions = []} _hostSsh
Expand Down
1 change: 0 additions & 1 deletion website/.envrc

This file was deleted.

61 changes: 0 additions & 61 deletions website/flake.lock

This file was deleted.

24 changes: 0 additions & 24 deletions website/flake.nix

This file was deleted.

34 changes: 26 additions & 8 deletions website/src/components/report/TabulateSshKeys.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Chip } from '@nextui-org/chip';
import { Radio, RadioGroup, Select, SelectItem, Selection } from '@nextui-org/react';
import { Table, TableBody, TableCell, TableColumn, TableHeader, TableRow } from '@nextui-org/table';
import { useEffect, useState } from 'react';
import { toast } from 'react-toastify';

export function TabulateSshKeys({ records }: { records: SshKeysTableRecord[] }) {
const [filters, setFilters] = useState<Record<string, (record: SshKeysTableRecord) => boolean>>({});
Expand Down Expand Up @@ -135,13 +136,7 @@ export function TabulateSshKeys({ records }: { records: SshKeysTableRecord[] })
</div>
</div>

<Table
aria-label="Table of SSH Keys"
removeWrapper
selectionMode="multiple"
color="secondary"
showSelectionCheckboxes={false}
>
<Table aria-label="Table of SSH Keys" removeWrapper color="secondary" showSelectionCheckboxes={false}>
<TableHeader>
<TableColumn key="type">Type</TableColumn>
<TableColumn key="length">Length</TableColumn>
Expand All @@ -164,7 +159,30 @@ export function TabulateSshKeys({ records }: { records: SshKeysTableRecord[] })
<Chip color="danger">UNKNOWN</Chip>
)}
</TableCell>
<TableCell>{record.key.fingerprint}</TableCell>
<TableCell>
{record.key.fingerprint}
<div>
<span
className="mr-2 cursor-pointer"
onClick={() => {
navigator.clipboard.writeText(record.key.fingerprint);
toast('Fingerprint is copied to clipboard.');
}}
>
(copy fingerprint)
</span>

<span
className="cursor-pointer"
onClick={() => {
navigator.clipboard.writeText(record.key.data);
toast('Fingerprint is copied to clipboard.');
}}
>
(copy key)
</span>
</div>
</TableCell>
<TableCell>{record.seenHosts.size}</TableCell>
<TableCell>
{Array.from(record.seenHosts).map((h) => (
Expand Down