fix(macos): allow identity refresh off MainActor
This commit is contained in:
@@ -277,14 +277,14 @@ final class GatewayDiscoveryModel {
|
|||||||
resolver.start()
|
resolver.start()
|
||||||
}
|
}
|
||||||
|
|
||||||
private static func prettifyInstanceName(_ decodedName: String) -> String {
|
nonisolated private static func prettifyInstanceName(_ decodedName: String) -> String {
|
||||||
let normalized = decodedName.split(whereSeparator: \.isWhitespace).joined(separator: " ")
|
let normalized = decodedName.split(whereSeparator: \.isWhitespace).joined(separator: " ")
|
||||||
let stripped = normalized.replacingOccurrences(of: " (Clawdis)", with: "")
|
let stripped = normalized.replacingOccurrences(of: " (Clawdis)", with: "")
|
||||||
.replacingOccurrences(of: #"\s+\(\d+\)$"#, with: "", options: .regularExpression)
|
.replacingOccurrences(of: #"\s+\(\d+\)$"#, with: "", options: .regularExpression)
|
||||||
return stripped.trimmingCharacters(in: .whitespacesAndNewlines)
|
return stripped.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||||
}
|
}
|
||||||
|
|
||||||
private static func prettifyServiceName(_ decodedName: String) -> String {
|
nonisolated private static func prettifyServiceName(_ decodedName: String) -> String {
|
||||||
let normalized = Self.prettifyInstanceName(decodedName)
|
let normalized = Self.prettifyInstanceName(decodedName)
|
||||||
var cleaned = normalized.replacingOccurrences(of: #"\s*-?bridge$"#, with: "", options: .regularExpression)
|
var cleaned = normalized.replacingOccurrences(of: #"\s*-?bridge$"#, with: "", options: .regularExpression)
|
||||||
cleaned = cleaned
|
cleaned = cleaned
|
||||||
@@ -304,7 +304,7 @@ final class GatewayDiscoveryModel {
|
|||||||
return titled.isEmpty ? normalized : titled
|
return titled.isEmpty ? normalized : titled
|
||||||
}
|
}
|
||||||
|
|
||||||
static func isLocalGateway(
|
nonisolated static func isLocalGateway(
|
||||||
lanHost: String?,
|
lanHost: String?,
|
||||||
tailnetDns: String?,
|
tailnetDns: String?,
|
||||||
displayName: String?,
|
displayName: String?,
|
||||||
@@ -350,7 +350,7 @@ final class GatewayDiscoveryModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static func mergeLocalIdentity(
|
nonisolated private static func mergeLocalIdentity(
|
||||||
fast: LocalIdentity,
|
fast: LocalIdentity,
|
||||||
slow: LocalIdentity
|
slow: LocalIdentity
|
||||||
) -> LocalIdentity {
|
) -> LocalIdentity {
|
||||||
@@ -360,7 +360,7 @@ final class GatewayDiscoveryModel {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private static func buildLocalIdentityFast() -> LocalIdentity {
|
nonisolated private static func buildLocalIdentityFast() -> LocalIdentity {
|
||||||
var hostTokens: Set<String> = []
|
var hostTokens: Set<String> = []
|
||||||
var displayTokens: Set<String> = []
|
var displayTokens: Set<String> = []
|
||||||
|
|
||||||
@@ -376,7 +376,7 @@ final class GatewayDiscoveryModel {
|
|||||||
return LocalIdentity(hostTokens: hostTokens, displayTokens: displayTokens)
|
return LocalIdentity(hostTokens: hostTokens, displayTokens: displayTokens)
|
||||||
}
|
}
|
||||||
|
|
||||||
private static func buildLocalIdentitySlow() -> LocalIdentity {
|
nonisolated private static func buildLocalIdentitySlow() -> LocalIdentity {
|
||||||
var hostTokens: Set<String> = []
|
var hostTokens: Set<String> = []
|
||||||
var displayTokens: Set<String> = []
|
var displayTokens: Set<String> = []
|
||||||
|
|
||||||
@@ -393,7 +393,7 @@ final class GatewayDiscoveryModel {
|
|||||||
return LocalIdentity(hostTokens: hostTokens, displayTokens: displayTokens)
|
return LocalIdentity(hostTokens: hostTokens, displayTokens: displayTokens)
|
||||||
}
|
}
|
||||||
|
|
||||||
private static func normalizeHostToken(_ raw: String?) -> String? {
|
nonisolated private static func normalizeHostToken(_ raw: String?) -> String? {
|
||||||
guard let raw else { return nil }
|
guard let raw else { return nil }
|
||||||
let trimmed = raw.trimmingCharacters(in: .whitespacesAndNewlines)
|
let trimmed = raw.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||||
if trimmed.isEmpty { return nil }
|
if trimmed.isEmpty { return nil }
|
||||||
@@ -409,7 +409,7 @@ final class GatewayDiscoveryModel {
|
|||||||
return token.isEmpty ? nil : token
|
return token.isEmpty ? nil : token
|
||||||
}
|
}
|
||||||
|
|
||||||
private static func normalizeDisplayToken(_ raw: String?) -> String? {
|
nonisolated private static func normalizeDisplayToken(_ raw: String?) -> String? {
|
||||||
guard let raw else { return nil }
|
guard let raw else { return nil }
|
||||||
let prettified = Self.prettifyInstanceName(raw)
|
let prettified = Self.prettifyInstanceName(raw)
|
||||||
let trimmed = prettified.trimmingCharacters(in: .whitespacesAndNewlines)
|
let trimmed = prettified.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||||
@@ -417,7 +417,7 @@ final class GatewayDiscoveryModel {
|
|||||||
return trimmed.lowercased()
|
return trimmed.lowercased()
|
||||||
}
|
}
|
||||||
|
|
||||||
private static func normalizeServiceToken(_ raw: String?) -> String? {
|
nonisolated private static func normalizeServiceToken(_ raw: String?) -> String? {
|
||||||
guard let raw else { return nil }
|
guard let raw else { return nil }
|
||||||
let trimmed = raw.trimmingCharacters(in: .whitespacesAndNewlines)
|
let trimmed = raw.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||||
if trimmed.isEmpty { return nil }
|
if trimmed.isEmpty { return nil }
|
||||||
|
|||||||
Reference in New Issue
Block a user