fix(macos): clarify bridge discovery labels

This commit is contained in:
Peter Steinberger
2025-12-20 14:27:27 +00:00
parent b6c11154ae
commit 066a2828c4
3 changed files with 32 additions and 7 deletions

View File

@@ -18,7 +18,7 @@ struct GatewayDiscoveryInlineList: View {
}
if self.discovery.gateways.isEmpty {
Text("No gateways found yet.")
Text("No bridges found yet.")
.font(.caption)
.foregroundStyle(.secondary)
} else {
@@ -82,7 +82,7 @@ struct GatewayDiscoveryInlineList: View {
.fill(Color(NSColor.controlBackgroundColor)))
}
}
.help("Click a discovered gateway to fill the SSH target.")
.help("Click a discovered bridge to fill the SSH target.")
}
private func suggestedSSHTarget(_ gateway: GatewayDiscoveryModel.DiscoveredGateway) -> String? {
@@ -130,6 +130,6 @@ struct GatewayDiscoveryMenu: View {
} label: {
Image(systemName: "dot.radiowaves.left.and.right")
}
.help("Discover Clawdis gateways on your LAN")
.help("Discover Clawdis bridges on your LAN")
}
}

View File

@@ -60,7 +60,8 @@ final class GatewayDiscoveryModel {
let advertisedName = txt["displayName"]
.map(Self.prettifyInstanceName)
.flatMap { $0.isEmpty ? nil : $0 }
let prettyName = advertisedName ?? Self.prettifyInstanceName(decodedName)
let prettyName =
advertisedName ?? Self.prettifyServiceName(decodedName)
var lanHost: String?
var tailnetDns: String?
@@ -177,6 +178,26 @@ final class GatewayDiscoveryModel {
return stripped.trimmingCharacters(in: .whitespacesAndNewlines)
}
private static func prettifyServiceName(_ decodedName: String) -> String {
let normalized = Self.prettifyInstanceName(decodedName)
var cleaned = normalized.replacingOccurrences(of: #"\s*-?bridge$"#, with: "", options: .regularExpression)
cleaned = cleaned
.replacingOccurrences(of: "_", with: " ")
.replacingOccurrences(of: "-", with: " ")
.replacingOccurrences(of: #"\s+"#, with: " ", options: .regularExpression)
.trimmingCharacters(in: .whitespacesAndNewlines)
if cleaned.isEmpty {
cleaned = normalized
}
let words = cleaned.split(separator: " ")
let titled = words.map { word -> String in
let lower = word.lowercased()
guard let first = lower.first else { return "" }
return String(first).uppercased() + lower.dropFirst()
}.joined(separator: " ")
return titled.isEmpty ? normalized : titled
}
static func isLocalGateway(
lanHost: String?,
tailnetDns: String?,

View File

@@ -279,7 +279,7 @@ struct OnboardingView: View {
.font(.largeTitle.weight(.semibold))
Text(
"Clawdis uses a single Gateway that stays running. Pick this Mac, " +
"connect to a discovered Gateway nearby, or configure later.")
"connect to a discovered bridge nearby for pairing, or configure later.")
.font(.body)
.foregroundStyle(.secondary)
.multilineTextAlignment(.center)
@@ -323,12 +323,16 @@ struct OnboardingView: View {
}
if self.gatewayDiscovery.gateways.isEmpty {
Text("Searching for nearby gateways…")
Text("Searching for nearby bridges…")
.font(.caption)
.foregroundStyle(.secondary)
.padding(.leading, 4)
} else {
VStack(alignment: .leading, spacing: 6) {
Text("Nearby bridges (pairing only)")
.font(.caption)
.foregroundStyle(.secondary)
.padding(.leading, 4)
ForEach(self.gatewayDiscovery.gateways.prefix(6)) { gateway in
self.connectionChoiceButton(
title: gateway.displayName,
@@ -1336,7 +1340,7 @@ struct OnboardingView: View {
if shouldMonitor, !self.monitoringDiscovery {
self.monitoringDiscovery = true
Task { @MainActor in
try? await Task.sleep(nanoseconds: 250_000_000)
try? await Task.sleep(nanoseconds: 550_000_000)
guard self.monitoringDiscovery else { return }
self.gatewayDiscovery.start()
await self.refreshLocalGatewayProbe()