mirror of
https://github.com/EthanShoeDev/fressh.git
synced 2026-01-12 23:02:49 +00:00
commit
This commit is contained in:
@@ -483,6 +483,18 @@ pub fn list_ssh_connections() -> Vec<SshConnectionInfo> {
|
||||
out
|
||||
}
|
||||
|
||||
#[uniffi::export]
|
||||
pub fn list_ssh_shells() -> Vec<ShellSessionInfo> {
|
||||
// Collect shells outside the lock to avoid holding a MutexGuard across await
|
||||
let shells: Vec<Arc<ShellSession>> = SHELLS
|
||||
.lock()
|
||||
.map(|map| map.values().cloned().collect())
|
||||
.unwrap_or_default();
|
||||
let mut out = Vec::with_capacity(shells.len());
|
||||
for shell in shells { out.push(shell.info()); }
|
||||
out
|
||||
}
|
||||
|
||||
#[uniffi::export]
|
||||
pub fn get_ssh_connection(id: String) -> Result<Arc<SSHConnection>, SshError> {
|
||||
if let Ok(map) = CONNECTIONS.lock() { if let Some(conn) = map.get(&id) { return Ok(conn.clone()); } }
|
||||
|
||||
Reference in New Issue
Block a user