This commit is contained in:
EthanShoeDev
2025-09-15 15:48:13 -04:00
parent b666ec72a7
commit b078d97af1
9 changed files with 128 additions and 60 deletions

View File

@@ -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()); } }