hostsview - list of hosts

hostmanager for loading and saving hosts to defaults
host.debug/.blank as static vars
fix crash on disconnect by checking for connection in timer before checking if channel is open
keychain layer? to convert ed25519 to seckey and back for keychain storage
generate ed25519 via cryptokit
This commit is contained in:
neon443
2025-06-20 13:40:20 +01:00
parent 86dd316e33
commit a06de0b4c4
12 changed files with 239 additions and 45 deletions

View File

@@ -30,7 +30,7 @@ class SSHHandler: ObservableObject {
) {
self.host = host
#if DEBUG
self.host = debugHost()
self.host = Host.debug
#endif
}
@@ -87,9 +87,9 @@ class SSHHandler: ObservableObject {
}
ssh_disconnect(session)
ssh_free(session)
session = nil
withAnimation { authorized = false }
withAnimation { connected = false }
session = nil
host.key = nil
}
@@ -296,12 +296,12 @@ class SSHHandler: ObservableObject {
guard status == SSH_OK else { return }
self.readTimer = Timer(timeInterval: 0.1, repeats: true) { timer in
guard ssh_channel_is_open(self.channel) != 0 else {
guard self.connected else {
timer.invalidate()
self.readTimer = nil
return
}
guard ssh_channel_is_eof(self.channel) == 0 else {
guard ssh_channel_is_open(self.channel) != 0 && ssh_channel_is_eof(self.channel) == 0 else {
timer.invalidate()
self.readTimer = nil
return