feat: add terminal broadcast, context menu, and shell close
Complete multi-pane broadcast, standard terminal right-click actions, batch host selection with progress, and native ssh_close_shell so closing a pane tears down the remote shell. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
494ef6b9d0
commit
9ce71795b8
38 files changed
+1437
-186
No files matched your search
@@ -121,6 +121,11 @@ pub fn ssh_shell_resize(
|
||||
operation(state.ssh.shell_resize(&shell_id, cols, rows))
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn ssh_close_shell(state: State<'_, AppState>, shell_id: String) -> OperationResponse {
|
||||
operation(state.ssh.close_shell(&shell_id))
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn sftp_connect(state: State<'_, AppState>, connection_id: String) -> IdResponse {
|
||||
match state.ssh.create_sftp(&connection_id) {
|
||||
|
||||
@@ -73,6 +73,7 @@ pub fn run() {
|
||||
commands::ssh::ssh_create_shell,
|
||||
commands::ssh::ssh_shell_write,
|
||||
commands::ssh::ssh_shell_resize,
|
||||
commands::ssh::ssh_close_shell,
|
||||
commands::ssh::sftp_connect,
|
||||
commands::ssh::sftp_list_directory,
|
||||
commands::ssh::sftp_upload,
|
||||
|
||||
@@ -212,6 +212,19 @@ impl SshService {
|
||||
.map_err(|error| format!("调整远程终端尺寸失败: {error}"))
|
||||
}
|
||||
|
||||
pub fn close_shell(&self, shell_id: &str) -> Result<(), String> {
|
||||
let mut shell = self
|
||||
.shells
|
||||
.lock()
|
||||
.map_err(lock_error)?
|
||||
.remove(shell_id)
|
||||
.ok_or_else(|| format!("远程 Shell 不存在: {shell_id}"))?;
|
||||
let _ = shell.channel.send_eof();
|
||||
let _ = shell.channel.close();
|
||||
let _ = shell.session.disconnect(None, "shell closed by user", None);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn forward_local(
|
||||
&self,
|
||||
connection_id: &str,
|
||||
|
||||
Reference in new issue
Block a user