https issue erledigt
This commit is contained in:
BIN
Binary file not shown.
@@ -15,7 +15,15 @@ struct DockgeServer: Identifiable, Codable {
|
|||||||
|
|
||||||
var baseURL: URL? {
|
var baseURL: URL? {
|
||||||
let scheme = useSSL ? "https" : "http"
|
let scheme = useSSL ? "https" : "http"
|
||||||
return URL(string: "\(scheme)://\(host)")
|
var cleanHost = host.trimmingCharacters(in: .whitespaces)
|
||||||
|
for prefix in ["https://", "http://"] {
|
||||||
|
if cleanHost.lowercased().hasPrefix(prefix) {
|
||||||
|
cleanHost = String(cleanHost.dropFirst(prefix.count))
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cleanHost = cleanHost.trimmingCharacters(in: CharacterSet(charactersIn: "/"))
|
||||||
|
return URL(string: "\(scheme)://\(cleanHost)")
|
||||||
}
|
}
|
||||||
|
|
||||||
var displayHost: String { host }
|
var displayHost: String { host }
|
||||||
|
|||||||
@@ -153,6 +153,9 @@ final class SocketIOClient: NSObject {
|
|||||||
Task { @MainActor [weak self] in
|
Task { @MainActor [weak self] in
|
||||||
guard let self else { return }
|
guard let self else { return }
|
||||||
self.connectionState = .disconnected
|
self.connectionState = .disconnected
|
||||||
|
self.webSocketTask?.cancel(with: .goingAway, reason: nil)
|
||||||
|
self.webSocketTask = nil
|
||||||
|
self.pendingAcks.removeAll()
|
||||||
self.errorHandlers.forEach { $0(error) }
|
self.errorHandlers.forEach { $0(error) }
|
||||||
self.disconnectHandlers.forEach { $0() }
|
self.disconnectHandlers.forEach { $0() }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,7 +62,17 @@ struct AddServerView: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private func save() {
|
private func save() {
|
||||||
let trimmedHost = host.trimmingCharacters(in: .whitespaces)
|
var trimmedHost = host.trimmingCharacters(in: .whitespaces)
|
||||||
|
// Strip any scheme the user may have pasted in
|
||||||
|
if trimmedHost.lowercased().hasPrefix("https://") {
|
||||||
|
trimmedHost = String(trimmedHost.dropFirst("https://".count))
|
||||||
|
useSSL = true
|
||||||
|
} else if trimmedHost.lowercased().hasPrefix("http://") {
|
||||||
|
trimmedHost = String(trimmedHost.dropFirst("http://".count))
|
||||||
|
useSSL = false
|
||||||
|
}
|
||||||
|
// Strip trailing slash
|
||||||
|
trimmedHost = trimmedHost.trimmingCharacters(in: CharacterSet(charactersIn: "/"))
|
||||||
if var existing = editingServer {
|
if var existing = editingServer {
|
||||||
existing.name = name.trimmingCharacters(in: .whitespaces)
|
existing.name = name.trimmingCharacters(in: .whitespaces)
|
||||||
existing.host = trimmedHost
|
existing.host = trimmedHost
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ struct LoginView: View {
|
|||||||
@Environment(\.dismiss) private var dismiss
|
@Environment(\.dismiss) private var dismiss
|
||||||
@State private var username = ""
|
@State private var username = ""
|
||||||
@State private var password = ""
|
@State private var password = ""
|
||||||
|
@State private var showPassword = false
|
||||||
@State private var twoFAToken = ""
|
@State private var twoFAToken = ""
|
||||||
@State private var showTwoFA = false
|
@State private var showTwoFA = false
|
||||||
@State private var showSetup = false
|
@State private var showSetup = false
|
||||||
@@ -53,8 +54,24 @@ struct LoginView: View {
|
|||||||
.padding()
|
.padding()
|
||||||
.background(Color.appSurface, in: RoundedRectangle(cornerRadius: 10))
|
.background(Color.appSurface, in: RoundedRectangle(cornerRadius: 10))
|
||||||
|
|
||||||
|
HStack {
|
||||||
|
Group {
|
||||||
|
if showPassword {
|
||||||
|
TextField("Password", text: $password)
|
||||||
|
} else {
|
||||||
SecureField("Password", text: $password)
|
SecureField("Password", text: $password)
|
||||||
|
}
|
||||||
|
}
|
||||||
.textFieldStyle(.plain)
|
.textFieldStyle(.plain)
|
||||||
|
.autocorrectionDisabled()
|
||||||
|
.textInputAutocapitalization(.never)
|
||||||
|
Button {
|
||||||
|
showPassword.toggle()
|
||||||
|
} label: {
|
||||||
|
Image(systemName: showPassword ? "eye.slash" : "eye")
|
||||||
|
.foregroundStyle(.appGray)
|
||||||
|
}
|
||||||
|
}
|
||||||
.padding()
|
.padding()
|
||||||
.background(Color.appSurface, in: RoundedRectangle(cornerRadius: 10))
|
.background(Color.appSurface, in: RoundedRectangle(cornerRadius: 10))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user