[Init] Initial commit - NetMesh terminal manager
Some checks failed
build-packages / resolve bundled mosh-client (push) Has been cancelled
build-packages / resolve bundled et-client (push) Has been cancelled
build-packages / build-macos (push) Has been cancelled
build-packages / build-windows (push) Has been cancelled
build-packages / build-linux-x64 (push) Has been cancelled
build-packages / build-linux-arm64 (push) Has been cancelled
build-packages / release (push) Has been cancelled
build-packages / update Nix release metadata (push) Has been cancelled
build-packages / bump homebrew tap (push) Has been cancelled
test / lint-and-test (push) Has been cancelled
AI automation / Route event (push) Has been cancelled
AI automation / Hand reopened issue to maintainers (push) Has been cancelled
AI automation / Clean source issue state (push) Has been cancelled
AI automation / Reconcile handoffs (push) Has been cancelled
AI automation / Classify issue (push) Has been cancelled
AI automation / Claude Code smoke (push) Has been cancelled
AI automation / Review issue follow-up (push) Has been cancelled
AI automation / Publish issue follow-up (push) Has been cancelled
AI automation / Implement with Claude Code (push) Has been cancelled
AI automation / Publish implement PR (push) Has been cancelled
AI automation / Continue queued issue comments (push) Has been cancelled
AI automation / Codex review loop (push) Has been cancelled
AI automation / Publish Codex fix (push) Has been cancelled
AI automation / Clear Codex dispatch marker (push) Has been cancelled
AI automation / Own PR re-request Codex (push) Has been cancelled
AI automation / External PR re-request Codex (push) Has been cancelled
AI automation / Poll Codex reaction / retry (push) Has been cancelled
build-et-binaries / build-linux-x64 (push) Has been cancelled
build-et-binaries / build-linux-arm64 (push) Has been cancelled
build-et-binaries / build-macos-universal (push) Has been cancelled
build-et-binaries / build-windows-x64 (push) Has been cancelled
build-et-binaries / release (push) Has been cancelled
Some checks failed
build-packages / resolve bundled mosh-client (push) Has been cancelled
build-packages / resolve bundled et-client (push) Has been cancelled
build-packages / build-macos (push) Has been cancelled
build-packages / build-windows (push) Has been cancelled
build-packages / build-linux-x64 (push) Has been cancelled
build-packages / build-linux-arm64 (push) Has been cancelled
build-packages / release (push) Has been cancelled
build-packages / update Nix release metadata (push) Has been cancelled
build-packages / bump homebrew tap (push) Has been cancelled
test / lint-and-test (push) Has been cancelled
AI automation / Route event (push) Has been cancelled
AI automation / Hand reopened issue to maintainers (push) Has been cancelled
AI automation / Clean source issue state (push) Has been cancelled
AI automation / Reconcile handoffs (push) Has been cancelled
AI automation / Classify issue (push) Has been cancelled
AI automation / Claude Code smoke (push) Has been cancelled
AI automation / Review issue follow-up (push) Has been cancelled
AI automation / Publish issue follow-up (push) Has been cancelled
AI automation / Implement with Claude Code (push) Has been cancelled
AI automation / Publish implement PR (push) Has been cancelled
AI automation / Continue queued issue comments (push) Has been cancelled
AI automation / Codex review loop (push) Has been cancelled
AI automation / Publish Codex fix (push) Has been cancelled
AI automation / Clear Codex dispatch marker (push) Has been cancelled
AI automation / Own PR re-request Codex (push) Has been cancelled
AI automation / External PR re-request Codex (push) Has been cancelled
AI automation / Poll Codex reaction / retry (push) Has been cancelled
build-et-binaries / build-linux-x64 (push) Has been cancelled
build-et-binaries / build-linux-arm64 (push) Has been cancelled
build-et-binaries / build-macos-universal (push) Has been cancelled
build-et-binaries / build-windows-x64 (push) Has been cancelled
build-et-binaries / release (push) Has been cancelled
This commit is contained in:
103
components/port-forwarding/PortForwardHostKeyTrayPrompt.tsx
Normal file
103
components/port-forwarding/PortForwardHostKeyTrayPrompt.tsx
Normal file
@@ -0,0 +1,103 @@
|
||||
import React from "react";
|
||||
import type { KnownHost } from "../../domain/models";
|
||||
import { usePortForwardHostKeyVerification } from "../../application/state/usePortForwardHostKeyVerification";
|
||||
import { useI18n } from "../../application/i18n/I18nProvider";
|
||||
import { cn } from "../../lib/utils";
|
||||
import { Button } from "../ui/button";
|
||||
|
||||
interface PortForwardHostKeyTrayPromptProps {
|
||||
onAddKnownHost?: (knownHost: KnownHost) => void;
|
||||
}
|
||||
|
||||
export const PortForwardHostKeyTrayPrompt: React.FC<PortForwardHostKeyTrayPromptProps> = ({
|
||||
onAddKnownHost,
|
||||
}) => {
|
||||
const { t } = useI18n();
|
||||
const {
|
||||
hostKeyVerification,
|
||||
rejectHostKeyVerification,
|
||||
acceptHostKeyVerification,
|
||||
acceptAndSaveHostKeyVerification,
|
||||
} = usePortForwardHostKeyVerification(onAddKnownHost);
|
||||
|
||||
if (!hostKeyVerification) return null;
|
||||
|
||||
const { hostKeyInfo } = hostKeyVerification;
|
||||
const isChanged = hostKeyInfo.status === "changed";
|
||||
|
||||
return (
|
||||
<div
|
||||
data-port-forward-host-key-tray-prompt="true"
|
||||
className={cn(
|
||||
"px-3 py-2",
|
||||
isChanged ? "bg-destructive/8" : "bg-muted/45",
|
||||
)}
|
||||
>
|
||||
<div className="flex items-start justify-between gap-3">
|
||||
<div className="min-w-0 flex-1">
|
||||
<div
|
||||
className={cn(
|
||||
"truncate text-xs font-semibold",
|
||||
isChanged ? "text-destructive" : "text-foreground",
|
||||
)}
|
||||
>
|
||||
{isChanged
|
||||
? t("terminal.hostKey.changedTitle")
|
||||
: t("terminal.hostKey.unknownTitle")}
|
||||
</div>
|
||||
<div className="truncate text-xs text-muted-foreground">
|
||||
{hostKeyInfo.hostname}:{hostKeyInfo.port}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="mt-1.5 text-[10px] leading-4 text-muted-foreground">
|
||||
{t("terminal.hostKey.fingerprintLabel", { keyType: hostKeyInfo.keyType })}
|
||||
<code className="ml-1 break-all font-mono text-[11px] text-foreground/90">
|
||||
{hostKeyInfo.fingerprint}
|
||||
</code>
|
||||
</div>
|
||||
|
||||
{isChanged && hostKeyInfo.knownFingerprint && (
|
||||
<div className="mt-1.5 text-[10px] leading-4 text-muted-foreground">
|
||||
<span className="font-medium text-destructive">
|
||||
{t("terminal.hostKey.savedFingerprintLabel")}
|
||||
</span>
|
||||
<code className="ml-1 break-all font-mono text-[11px] text-foreground/90">
|
||||
{hostKeyInfo.knownFingerprint}
|
||||
</code>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="mt-2 grid grid-cols-[auto_auto_1fr] gap-1">
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
className="h-6 px-1.5 text-[10px]"
|
||||
onClick={rejectHostKeyVerification}
|
||||
>
|
||||
{t("common.close")}
|
||||
</Button>
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
className="h-6 px-1.5 text-[10px]"
|
||||
onClick={acceptHostKeyVerification}
|
||||
>
|
||||
{t("common.continue")}
|
||||
</Button>
|
||||
<Button
|
||||
size="sm"
|
||||
className="h-6 min-w-0 px-1.5 text-[10px]"
|
||||
onClick={acceptAndSaveHostKeyVerification}
|
||||
>
|
||||
<span className="truncate">
|
||||
{isChanged
|
||||
? t("terminal.hostKey.updateAndContinue")
|
||||
: t("terminal.hostKey.addAndContinue")}
|
||||
</span>
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user