Show both sign-ins on the first screen and find servers automatically
This commit is contained in:
@@ -265,7 +265,6 @@ final class ConnectForm {
|
||||
var problem: String?
|
||||
var missing: [Check] = []
|
||||
var connecting = false
|
||||
var serviceLogin: TailnetInfo?
|
||||
|
||||
func connect() async -> URL? {
|
||||
guard let origin = parseOrigin(serverText) else {
|
||||
@@ -303,7 +302,6 @@ final class ConnectForm {
|
||||
try await waitForServer(origin)
|
||||
} catch {
|
||||
connecting = false
|
||||
serviceLogin = nil
|
||||
problem = errorText(error)
|
||||
return nil
|
||||
}
|
||||
@@ -315,13 +313,11 @@ final class ConnectForm {
|
||||
while true {
|
||||
let info = try? await Server.tailnet(loopback)
|
||||
if let info, info.state == "Running" {
|
||||
serviceLogin = nil
|
||||
guard let origin = URL(string: info.origin), !info.origin.isEmpty else {
|
||||
throw ProcessFailure(errorDescription: noCertificates)
|
||||
}
|
||||
return origin
|
||||
}
|
||||
serviceLogin = info
|
||||
if info == nil, Date().timeIntervalSince(started) > 10 {
|
||||
throw ProcessFailure(errorDescription: "byre was installed but \(loopback.absoluteString) didn't answer within 10 s.")
|
||||
}
|
||||
@@ -408,9 +404,6 @@ struct ConnectView: View {
|
||||
Button("Run byre on this Mac", action: installHere)
|
||||
}
|
||||
.disabled(form.connecting)
|
||||
if let login = form.serviceLogin {
|
||||
ServiceLoginView(info: login)
|
||||
}
|
||||
if let problem = form.problem {
|
||||
Text(problem)
|
||||
.foregroundStyle(Palette.danger)
|
||||
@@ -484,7 +477,7 @@ struct ServerWindow: View {
|
||||
|
||||
@ViewBuilder
|
||||
private var content: some View {
|
||||
if !Tailnet.shared.running {
|
||||
if !Tailnet.shared.signedIn {
|
||||
TailnetLoginView()
|
||||
} else if let connection {
|
||||
switch connection.phase {
|
||||
|
||||
Reference in New Issue
Block a user