RemminaMac 0.1.0: SSH/RDP-Client für macOS (SwiftUI, Remmina-Layout, Profile, SSH-Keys, Docs, Release-Skripte)
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
import SwiftUI
|
||||
|
||||
struct SessionView: View {
|
||||
let profile: ConnectionProfile
|
||||
@Binding var statusMessage: String
|
||||
@EnvironmentObject var store: ProfileStore
|
||||
@State private var log: String = ""
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading, spacing: 8) {
|
||||
HStack {
|
||||
Image(systemName: profile.proto.systemImage).font(.title2)
|
||||
VStack(alignment: .leading) {
|
||||
Text(profile.name).font(.headline)
|
||||
Text("\(profile.proto.rawValue) · \(profile.username)@\(profile.host):\(profile.port)")
|
||||
.font(.subheadline).foregroundStyle(.secondary)
|
||||
}
|
||||
Spacer()
|
||||
if profile.proto == .ssh || profile.proto == .sftp {
|
||||
Button("In Terminal öffnen") {
|
||||
SSHService.openInTerminal(profile: profile, key: store.key(for: profile))
|
||||
}
|
||||
Button("Befehl kopieren") {
|
||||
SSHService.copyCommandToClipboard(profile: profile, key: store.key(for: profile))
|
||||
statusMessage = "SSH-Befehl kopiert."
|
||||
}
|
||||
} else if profile.proto == .rdp {
|
||||
Button("RDP erneut verbinden") { RDPService.connect(profile: profile) }
|
||||
}
|
||||
}
|
||||
.padding()
|
||||
|
||||
GroupBox("Verbindungsdetails") {
|
||||
let key = store.key(for: profile)
|
||||
let cmd = profile.proto == .ssh || profile.proto == .sftp
|
||||
? SSHService.sshCommandString(for: profile, key: key)
|
||||
: "\(profile.proto.rawValue) \(profile.host):\(profile.port)"
|
||||
Text(cmd)
|
||||
.font(.system(.body, design: .monospaced))
|
||||
.textSelection(.enabled)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.padding(8)
|
||||
}
|
||||
.padding(.horizontal)
|
||||
|
||||
GroupBox("Hinweis") {
|
||||
Text(hintText)
|
||||
.font(.callout).foregroundStyle(.secondary)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.padding(8)
|
||||
}
|
||||
.padding(.horizontal)
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
}
|
||||
|
||||
var hintText: String {
|
||||
switch profile.proto {
|
||||
case .ssh:
|
||||
return "SSH wird in Terminal.app geöffnet (System-ssh). Für ein eingebettetes Terminal als nächsten Schritt SwiftTerm + swift-nio-ssh einbinden."
|
||||
case .sftp:
|
||||
return "SFTP nutzt denselben SSH-Zugang. Befehl kopieren und z. B. mit Cyberduck / Transmit / sftp im Terminal nutzen: sftp -P \(profile.port) \(profile.username)@\(profile.host)."
|
||||
case .rdp:
|
||||
return RDPService.freeRDPPath != nil
|
||||
? "Verbunden über xfreerdp (\(RDPService.freeRDPPath!))."
|
||||
: "Kein xfreerdp gefunden (brew install freerdp). Fallback: Microsoft Remote Desktop wird geöffnet."
|
||||
case .vnc:
|
||||
return "VNC wird über die System-Freigabe (open vnc://) geöffnet."
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user