From 250ba269f57ef2f6c2e6d5d781619d858c4486a4 Mon Sep 17 00:00:00 2001 From: mamamiyear Date: Fri, 12 Jun 2026 14:12:11 +0800 Subject: [PATCH] feat: [WIP] implement scp by bgo --- app.go | 21 +- frontend/src/views/SettingsView.vue | 13 ++ internal/application/capture_ssh.go | 17 ++ internal/domain/config.go | 48 +++-- internal/infrastructure/ssh/bgo_uploader.go | 200 ++++++++++++++++++++ 5 files changed, 278 insertions(+), 21 deletions(-) create mode 100644 internal/infrastructure/ssh/bgo_uploader.go diff --git a/app.go b/app.go index eabc3b5..63c7d51 100644 --- a/app.go +++ b/app.go @@ -340,12 +340,16 @@ func (a *App) runSaveRemotePipeline(pngBytes []byte) error { "auth_method", cfg.SSH.AuthMethod, "png_size", len(pngBytes)) // Select the uploader by auth method: Kerberos delegates to the system - // ssh/scp binaries (reusing the kinit credential cache), while builtin - // uses the in-process Go SSH client. + // ssh/scp binaries (reusing the kinit credential cache), bgo delegates to + // the internal `bgo scp` client (under a PTY), while builtin uses the + // in-process Go SSH client. var uploader application.SSHUploader - if cfg.SSH.IsKerberos() { + switch { + case cfg.SSH.IsKerberos(): uploader = sshpkg.NewKerberosUploader(cfg.SSH) - } else { + case cfg.SSH.IsBgo(): + uploader = sshpkg.NewBgoUploader(cfg.SSH) + default: uploader = sshpkg.NewUploader(cfg.SSH) } @@ -467,6 +471,15 @@ func (a *App) TestSSHConnection(cfg domain.SSHConfig) error { } return nil } + // bgo manages its own auth; we can only confirm the binary is installed + // and resolvable (a real transfer would need a live remote + PTY). + if cfg.IsBgo() { + if err := sshpkg.TestBgoConnection(a.ctx, cfg); err != nil { + slog.Error("RPC TestSSHConnection (bgo) failed", "err", err) + return err + } + return nil + } if err := sshpkg.TestConnection(a.ctx, cfg); err != nil { slog.Error("RPC TestSSHConnection failed", "err", err) return err diff --git a/frontend/src/views/SettingsView.vue b/frontend/src/views/SettingsView.vue index 4bcd2ca..a214b56 100644 --- a/frontend/src/views/SettingsView.vue +++ b/frontend/src/views/SettingsView.vue @@ -289,6 +289,7 @@ onMounted(load) +