From 061041e1d7f9ca3379ef6a1d4f2035424ee33b7f Mon Sep 17 00:00:00 2001 From: jearhe <0verme7753@gmail.com> Date: Wed, 2 Sep 2026 17:00:28 +0800 Subject: [PATCH] feat(ssh): support ssh agent auth in tunnel manager --- .../connection/TunnelProfileManager.vue | 15 +++++++------ .../sshAgentTunnelProfileManager.spec.ts | 21 +++++++++++++++++++ 2 files changed, 30 insertions(+), 6 deletions(-) create mode 100644 apps/desktop/src/lib/__tests__/connection/sshAgentTunnelProfileManager.spec.ts diff --git a/apps/desktop/src/components/connection/TunnelProfileManager.vue b/apps/desktop/src/components/connection/TunnelProfileManager.vue index 873ff1b8a6..dbd0a7d014 100644 --- a/apps/desktop/src/components/connection/TunnelProfileManager.vue +++ b/apps/desktop/src/components/connection/TunnelProfileManager.vue @@ -13,6 +13,7 @@ import { useToast } from "@/composables/useToast"; import { useTunnelProfileStore } from "@/stores/tunnelProfileStore"; import { createTunnelProfile, createTunnelProfileTestGuard, tunnelProfileSummary, type TunnelProfileType } from "@/lib/connection/tunnelProfiles"; import { applySshConfigHostAliasPrefill as prefillSshConfigHostAlias } from "@/lib/connection/sshConfigHosts"; +import { applySshAuthMethod } from "@/lib/connection/sshAuthMethod"; import * as api from "@/lib/backend/api"; import type { SshConfigHostEntry, TunnelProfile } from "@/types/database"; import { translateBackendError } from "@/i18n/backend-errors"; @@ -118,15 +119,12 @@ function removeSelected() { selectedId.value = draft.value[0]?.id || null; } +// Shared with the connection editor so both SSH entry points keep one single +// auth-method <-> credential mapping (see sshAuthMethod.ts). function updateSshAuthMethod(value: unknown) { const profile = selectedSsh.value; if (!profile) return; - profile.auth_method = value === "key" ? "key" : value === "key+password" ? "key+password" : value === "none" ? "none" : "password"; - if (profile.auth_method !== "password" && profile.auth_method !== "key+password") profile.password = ""; - if (profile.auth_method !== "key" && profile.auth_method !== "key+password") { - profile.key_path = ""; - profile.key_passphrase = ""; - } + applySshAuthMethod(profile, value); } function updateProxyType(value: unknown) { @@ -252,6 +250,7 @@ async function testSelected() { {{ t("connection.sshAuthMethodPassword") }} {{ t("connection.sshAuthMethodKey") }} {{ t("connection.sshAuthMethodKeyPassword") }} + {{ t("connection.sshUseAgent") }} {{ t("connection.sshAuthMethodNone") }} @@ -282,6 +281,10 @@ async function testSelected() {

{{ t("connection.sshAuthMethodNoneHint") }}

+
+ + +