This commit is contained in:
@@ -118,6 +118,31 @@ fn terminal_session_start(
|
||||
.map_err(|err| err.to_string())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
fn terminal_session_start_ssh(
|
||||
state: tauri::State<TerminalState>,
|
||||
host: String,
|
||||
user: Option<String>,
|
||||
port: Option<u16>,
|
||||
cols: Option<u16>,
|
||||
rows: Option<u16>,
|
||||
) -> Result<u64, String> {
|
||||
let mut registry = state
|
||||
.0
|
||||
.lock()
|
||||
.map_err(|_| "terminal registry lock poisoned".to_string())?;
|
||||
registry
|
||||
.spawn_ssh(
|
||||
host,
|
||||
user.as_deref(),
|
||||
port.unwrap_or(22),
|
||||
cols.unwrap_or(80),
|
||||
rows.unwrap_or(24),
|
||||
)
|
||||
.map(|id| id.0)
|
||||
.map_err(|err| err.to_string())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
fn terminal_session_write(
|
||||
state: tauri::State<TerminalState>,
|
||||
@@ -229,6 +254,7 @@ fn main() {
|
||||
load_app_config,
|
||||
save_app_config,
|
||||
terminal_session_start,
|
||||
terminal_session_start_ssh,
|
||||
terminal_session_write,
|
||||
terminal_session_read_until,
|
||||
terminal_session_resize,
|
||||
|
||||
Reference in New Issue
Block a user