From 626de357bad1f7a6c5a1edd3fb9493320ec9fab8 Mon Sep 17 00:00:00 2001 From: xuans Date: Fri, 2 Oct 2026 06:58:22 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4SSH=E5=AF=86=E9=92=A5?= =?UTF-8?q?=E5=85=A5=E5=8F=A3=E5=B9=B6=E5=9B=BA=E5=AE=9A=E5=AF=86=E7=A0=81?= =?UTF-8?q?=E8=AE=A4=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/internal/cli/root.go | 2 +- backend/internal/cli/scope_test.go | 4 +--- backend/internal/httpapi/server.go | 1 - frontend/src/views/Dashboard/Dashboard.js | 1 - frontend/src/views/Dashboard/Dashboard.test.js | 2 +- 5 files changed, 3 insertions(+), 7 deletions(-) diff --git a/backend/internal/cli/root.go b/backend/internal/cli/root.go index 736e22f..0c019f4 100644 --- a/backend/internal/cli/root.go +++ b/backend/internal/cli/root.go @@ -81,7 +81,7 @@ func newRootCommand() *cobra.Command { newLogsCommand(), newConfigCommand(), newBackupCommand(), newRestoreCommand(), newServiceCommand(), newDNSCommand(), ) - for _, name := range []string{"domain", "server", "ssh-key", "renew", "deploy"} { + for _, name := range []string{"domain", "server", "renew", "deploy"} { root.AddCommand(newRetiredBusinessCommand(name)) } localizeHelpFlags(root) diff --git a/backend/internal/cli/scope_test.go b/backend/internal/cli/scope_test.go index 233f80c..a3ce272 100644 --- a/backend/internal/cli/scope_test.go +++ b/backend/internal/cli/scope_test.go @@ -33,7 +33,7 @@ func TestRootExposesOnlyOperationalCommands(t *testing.T) { if err := root.Execute(); err != nil { t.Fatal(err) } - for _, name := range []string{"domain", "server", "ssh-key", "renew", "deploy"} { + for _, name := range []string{"domain", "server", "renew", "deploy"} { if strings.Contains(output.String(), "\n "+name+" ") { t.Errorf("正式帮助仍展示历史业务命令:%s", name) } @@ -48,8 +48,6 @@ func TestRetiredBusinessCommandsRejectBeforeAccessingData(t *testing.T) { {"domain", "import", "--private-key", "not-a-real-key.pem"}, {"server", "add", "--password", "test-secret-not-real"}, {"server", "delete", "--id", "example"}, - {"ssh-key", "add", "--name", "example"}, - {"ssh-key", "delete", "--id", "example"}, {"renew"}, {"renew", "--id", "example"}, {"deploy", "--id", "example"}, diff --git a/backend/internal/httpapi/server.go b/backend/internal/httpapi/server.go index 3791062..85c80d2 100644 --- a/backend/internal/httpapi/server.go +++ b/backend/internal/httpapi/server.go @@ -399,7 +399,6 @@ type serverRequest struct { Address string `json:"address" binding:"required"` Port int `json:"port"` Username string `json:"username" binding:"required"` - AuthMethod string `json:"auth_method"` Password string `json:"password"` HostKeyFingerprint string `json:"host_key_fingerprint" binding:"required"` CertificatePath string `json:"certificate_path"` diff --git a/frontend/src/views/Dashboard/Dashboard.js b/frontend/src/views/Dashboard/Dashboard.js index a192492..215c024 100644 --- a/frontend/src/views/Dashboard/Dashboard.js +++ b/frontend/src/views/Dashboard/Dashboard.js @@ -518,7 +518,6 @@ export function useDashboard() { address: serverForm.value.address, port: Number(serverForm.value.port), username: serverForm.value.username, - auth_method: "password", host_key_fingerprint: serverForm.value.host_key_fingerprint, certificate_path: serverForm.value.certificate_path, private_key_path: serverForm.value.private_key_path, diff --git a/frontend/src/views/Dashboard/Dashboard.test.js b/frontend/src/views/Dashboard/Dashboard.test.js index fda2861..8bff4f9 100644 --- a/frontend/src/views/Dashboard/Dashboard.test.js +++ b/frontend/src/views/Dashboard/Dashboard.test.js @@ -328,8 +328,8 @@ test("部署服务器仅使用密码认证且不暴露私钥管理入口", async state.serverForm.value.host_key_fingerprint = "SHA256:test"; await state.saveServer(); const payload = JSON.parse(requests.at(-1).body); - assert.equal(payload.auth_method, "password"); assert.equal(payload.password, "test-password"); + assert.equal("auth_method" in payload, false); assert.equal("private_key_ref" in payload, false); });