Files
ShhShell/ShhShell/Views/ContentView.swift
neon443 7adc2b7059 UI with custom host, username and pw
not hardcoded anymore
set host port username and pw
currently only password auth lol
can get hostkeys
replaced lots of fatalerrors with false returns
2025-06-06 21:14:11 +01:00

49 lines
972 B
Swift

//
// ContentView.swift
// ShhShell
//
// Created by neon443 on 02/06/2025.
//
import SwiftUI
struct ContentView: View {
@ObservedObject var handler: SSHHandler
var body: some View {
VStack {
TextField("address", text: $handler.address)
.textFieldStyle(.roundedBorder)
TextField(
"port",
text: Binding(
get: { String(handler.port) },
set: { handler.port = Int($0) ?? 22} )
)
.keyboardType(.numberPad)
.textFieldStyle(.roundedBorder)
TextField("username", text: $handler.username)
.textFieldStyle(.roundedBorder)
TextField("password", text: $handler.password)
.textFieldStyle(.roundedBorder)
Button("connect & auth") {
handler.connect()
handler.authWithPw()
}
Button("disconnect & free") {
handler.disconnect()
}
Button("testExec") {
handler.testExec()
}
}
}
}
#Preview {
ContentView(
handler: SSHHandler(username: "root", password: "root")
)
}