mirror of
https://github.com/neon443/ShhShell.git
synced 2026-03-11 13:26:16 +00:00
add none option for connection viwe
add key type picker
This commit is contained in:
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
enum KeyType: Codable, Equatable, Hashable, CustomStringConvertible {
|
enum KeyType: Codable, Equatable, Hashable, CustomStringConvertible, CaseIterable {
|
||||||
case ed25519
|
case ed25519
|
||||||
case rsa
|
case rsa
|
||||||
|
|
||||||
|
|||||||
@@ -80,9 +80,11 @@ struct ConnectionView: View {
|
|||||||
TextBox(label: "Password", text: $handler.host.password, prompt: "not required if using publickeys", secure: true)
|
TextBox(label: "Password", text: $handler.host.password, prompt: "not required if using publickeys", secure: true)
|
||||||
|
|
||||||
Picker("Private key", selection: $handler.host.privateKeyID) {
|
Picker("Private key", selection: $handler.host.privateKeyID) {
|
||||||
|
Text("None")
|
||||||
|
.tag(nil as UUID?)
|
||||||
ForEach(keyManager.keypairs) { keypair in
|
ForEach(keyManager.keypairs) { keypair in
|
||||||
Text(keypair.label)
|
Text(keypair.label)
|
||||||
.tag(keypair.id)
|
.tag(keypair.id as UUID?)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,12 +23,22 @@ struct KeyImporterView: View {
|
|||||||
var body: some View {
|
var body: some View {
|
||||||
List {
|
List {
|
||||||
TextBox(label: "Name", text: $keyName, prompt: "A name for your key")
|
TextBox(label: "Name", text: $keyName, prompt: "A name for your key")
|
||||||
|
|
||||||
|
Picker("Key type", selection: $keyType) {
|
||||||
|
ForEach(KeyType.allCases, id: \.self) { type in
|
||||||
|
Text(type.description)
|
||||||
|
.tag(type)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.pickerStyle(SegmentedPickerStyle())
|
||||||
|
|
||||||
HStack {
|
HStack {
|
||||||
Text("Private Key")
|
Text("Private Key")
|
||||||
Spacer()
|
Spacer()
|
||||||
Text("Required")
|
Text("Required")
|
||||||
.foregroundStyle(.red)
|
.foregroundStyle(.red)
|
||||||
}
|
}
|
||||||
|
|
||||||
TextEditor(text: $privkeyStr)
|
TextEditor(text: $privkeyStr)
|
||||||
|
|
||||||
TextEditor(text: .constant(keypair.openSshPubkey))
|
TextEditor(text: .constant(keypair.openSshPubkey))
|
||||||
|
|||||||
Reference in New Issue
Block a user