From 9b7e0e0f9a0d7de43f954f9fa48c60765bf0cb49 Mon Sep 17 00:00:00 2001 From: Cleboost Date: Wed, 29 Oct 2025 15:19:56 +0100 Subject: [PATCH] fix(server): skip connection test after SSH key deployment - Create server directly after successful key deployment - Remove unnecessary post-deployment connection test - Remove unused testConnectionAfterKeyDeployment function - Fix false error when deploying key with password authentication --- src/components/modal/NewServerModal.vue | 59 +------------------------ 1 file changed, 2 insertions(+), 57 deletions(-) diff --git a/src/components/modal/NewServerModal.vue b/src/components/modal/NewServerModal.vue index 8468737..1039c2c 100644 --- a/src/components/modal/NewServerModal.vue +++ b/src/components/modal/NewServerModal.vue @@ -246,61 +246,6 @@ async function deployKey() { password.value = ""; keyDeployed.value = true; - await testConnectionAfterKeyDeployment(); - } - } catch (error) { - logLines.value.push( - `[install-exception] ${(error as any)?.toString?.() ?? "error"}`, - ); - } finally { - deploying.value = false; - } -} - -async function testConnectionAfterKeyDeployment() { - testing.value = true; - connectionStatus.value = "testing"; - logLines.value = []; - - try { - const sshCmd = Command.create("ssh", [ - "-o", - "StrictHostKeyChecking=accept-new", - "-o", - "ConnectTimeout=8", - "-o", - "BatchMode=yes", - "-l", - username.value.trim(), - ip.value.trim(), - "exit", - ]); - - sshCmd.on("close", ({ code }) => { - logLines.value.push(`[exit] code=${code}`); - }); - - sshCmd.on("error", (err) => { - logLines.value.push(`[error] ${String(err)}`); - }); - - sshCmd.stdout.on("data", (line) => { - logLines.value.push(`[out] ${String(line).trimEnd()}`); - }); - - sshCmd.stderr.on("data", (line) => { - const text = String(line); - logLines.value.push(`[err] ${text.trimEnd()}`); - }); - - const status = await sshCmd.execute(); - - if (status.stdout) - logLines.value.push(`[out] ${status.stdout.trimEnd()}`); - if (status.stderr) - logLines.value.push(`[err] ${status.stderr.trimEnd()}`); - - if (status.code === 0) { await createServer(); connectionStatus.value = "success"; successModalOpen.value = true; @@ -310,12 +255,12 @@ async function testConnectionAfterKeyDeployment() { } } catch (error) { logLines.value.push( - `[exception] ${(error as any)?.toString?.() ?? "error"}`, + `[install-exception] ${(error as any)?.toString?.() ?? "error"}`, ); connectionStatus.value = "failed"; errorModalOpen.value = true; } finally { - testing.value = false; + deploying.value = false; } }