Terminal-Bugfix: In-App-PTY-Terminal im Dracula-Theme, .command-Fallback, ANSI-Parser-Fix, Doku

This commit is contained in:
x3
2026-09-21 22:59:17 +02:00
parent 8fe8c4925e
commit 1828a96a2b
9 changed files with 699 additions and 18 deletions
+20 -7
View File
@@ -4,7 +4,11 @@ struct SessionView: View {
let profile: ConnectionProfile
@Binding var statusMessage: String
@EnvironmentObject var store: ProfileStore
@State private var log: String = ""
@ObservedObject var term: PTYSession
var onClose: () -> Void
var isSSH: Bool { profile.proto == .ssh || profile.proto == .sftp }
var canConnect: Bool { !profile.host.isEmpty && !profile.username.isEmpty }
var body: some View {
VStack(alignment: .leading, spacing: 8) {
@@ -16,8 +20,8 @@ struct SessionView: View {
.font(.subheadline).foregroundStyle(.secondary)
}
Spacer()
if profile.proto == .ssh || profile.proto == .sftp {
Button("In Terminal öffnen") {
if isSSH {
Button("In Terminal.app öffnen") {
SSHService.openInTerminal(profile: profile, key: store.key(for: profile))
}
Button("Befehl kopieren") {
@@ -27,12 +31,20 @@ struct SessionView: View {
} else if profile.proto == .rdp {
Button("RDP erneut verbinden") { RDPService.connect(profile: profile) }
}
Button("Tab schließen") { onClose() }
}
.padding(.horizontal)
if isSSH {
// In-App-Terminal (Dracula) — kein externes Fenster mehr nötig
EmbeddedTerminalView(term: term, canConnect: canConnect)
.frame(minHeight: 380)
.padding(.horizontal)
}
.padding()
GroupBox("Verbindungsdetails") {
let key = store.key(for: profile)
let cmd = profile.proto == .ssh || profile.proto == .sftp
let cmd = isSSH
? SSHService.sshCommandString(for: profile, key: key)
: "\(profile.proto.rawValue) \(profile.host):\(profile.port)"
Text(cmd)
@@ -54,14 +66,15 @@ struct SessionView: View {
Spacer()
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
.padding(.top, 8)
}
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."
return "In-App-Terminal (Dracula-Theme) — läuft direkt in diesem Tab über ein PTY. Alternativ: In Terminal.app öffnen."
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)."
return "SFTP-Sitzung läuft im Terminal oben. Alternativ extern nutzen: sftp -P \(profile.port) \(profile.username)@\(profile.host)."
case .rdp:
return RDPService.freeRDPPath != nil
? "Verbunden über xfreerdp (\(RDPService.freeRDPPath!))."