From aed565e424c4ebe3aa00b73d1e553417e4e82876 Mon Sep 17 00:00:00 2001 From: Jokin Date: Sat, 11 Jul 2026 23:50:44 +0200 Subject: [PATCH] Key-file picker in the connection manager Choose... button beside the private-key field opens the native file dialog starting in ~/.ssh (Utils.openFileDialog via a pickKeyFile RPC). Co-Authored-By: Claude Fable 5 --- src/bun/rpc-handlers.ts | 14 +++++++++++ src/shared/rpc.ts | 4 ++++ .../connection-manager.html | 23 +++++++++++++------ .../connection-manager/connection-manager.ts | 7 ++++++ 4 files changed, 41 insertions(+), 7 deletions(-) diff --git a/src/bun/rpc-handlers.ts b/src/bun/rpc-handlers.ts index c91841c..5c7e17b 100644 --- a/src/bun/rpc-handlers.ts +++ b/src/bun/rpc-handlers.ts @@ -203,6 +203,20 @@ export function createAppRPC({ return { path }; }), + pickKeyFile: () => + wrap(async () => { + const { homedir } = await import("node:os"); + const picked = await Utils.openFileDialog({ + startingFolder: `${homedir()}/.ssh`, + allowedFileTypes: "*", + canChooseFiles: true, + canChooseDirectory: false, + allowsMultipleSelection: false, + }); + const path = picked.find((p) => p.trim().length > 0) ?? null; + return { path }; + }), + getEditLeftovers: () => wrap(async () => ({ names: await edits.listLeftovers() })), diff --git a/src/shared/rpc.ts b/src/shared/rpc.ts index 5cc1b80..1b10792 100644 --- a/src/shared/rpc.ts +++ b/src/shared/rpc.ts @@ -91,6 +91,10 @@ export type AppRPC = { params: Record; response: Result<{ path: string | null }>; }; + pickKeyFile: { + params: Record; + response: Result<{ path: string | null }>; + }; getEditLeftovers: { params: Record; response: Result<{ names: string[] }>; diff --git a/ui/src/app/connection-manager/connection-manager.html b/ui/src/app/connection-manager/connection-manager.html index a0bc4e3..55ca9a0 100644 --- a/ui/src/app/connection-manager/connection-manager.html +++ b/ui/src/app/connection-manager/connection-manager.html @@ -196,13 +196,22 @@ } @else {