Files
ShhShell/ShhShell/Views/Keys/HostkeysView.swift
T
neon443 ca34d3eafb may have actually fixed the whole hostkey changed flow, however accepting the new key causes the wierd keyboard issue when it opens the terminal
you can now forget hostkeys
removed the dispatchqueue on the disconnect function
updated updatehost to remove stupid ahh logic
2025-08-05 11:14:00 +01:00

72 lines
1.7 KiB
Swift

//
// HostkeysView.swift
// ShhShell
//
// Created by neon443 on 28/06/2025.
//
import SwiftUI
struct HostkeysView: View {
@ObservedObject var hostsManager: HostsManager
var body: some View {
ZStack {
hostsManager.selectedTheme.background.suiColor.opacity(0.7)
.ignoresSafeArea(.all)
NavigationStack {
List {
if hostsManager.hosts.isEmpty {
VStack(alignment: .leading) {
Text("Looking empty 'round here...")
.font(.title3)
.bold()
.padding(.bottom)
VStack(alignment: .leading) {
Text("Connect to some hosts to collect more hostkeys!")
.padding(.bottom)
Text("ShhShell remembers hostkey fingerprints for you, and will alert you if they change.")
.font(.subheadline)
Text("This could be due a man in the middle attack, where a bad actor tries to impersonate your server.")
.font(.subheadline)
}
}
}
ForEach($hostsManager.hosts) { $host in
VStack(alignment: .leading) {
if !host.name.isEmpty {
Text("name")
.foregroundStyle(.gray)
.font(.caption)
Text(host.name)
.bold()
}
Text("address")
.foregroundStyle(.gray)
.font(.caption)
Text(host.address)
.bold()
Text(host.key ?? "nil")
}
.swipeActions(edge: .trailing, allowsFullSwipe: true) {
Button(/*role: .destructive*/) {
host.key = nil
hostsManager.updateHost(host)
} label: {
Label("Forget", systemImage: "trash")
}
}
}
}
.scrollContentBackground(.hidden)
.navigationTitle("Hostkeys")
}
}
}
}
#Preview {
HostkeysView(hostsManager: HostsManager())
}