fix(macos): clarify bridge discovery labels
This commit is contained in:
@@ -18,7 +18,7 @@ struct GatewayDiscoveryInlineList: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if self.discovery.gateways.isEmpty {
|
if self.discovery.gateways.isEmpty {
|
||||||
Text("No gateways found yet.")
|
Text("No bridges found yet.")
|
||||||
.font(.caption)
|
.font(.caption)
|
||||||
.foregroundStyle(.secondary)
|
.foregroundStyle(.secondary)
|
||||||
} else {
|
} else {
|
||||||
@@ -82,7 +82,7 @@ struct GatewayDiscoveryInlineList: View {
|
|||||||
.fill(Color(NSColor.controlBackgroundColor)))
|
.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? {
|
private func suggestedSSHTarget(_ gateway: GatewayDiscoveryModel.DiscoveredGateway) -> String? {
|
||||||
@@ -130,6 +130,6 @@ struct GatewayDiscoveryMenu: View {
|
|||||||
} label: {
|
} label: {
|
||||||
Image(systemName: "dot.radiowaves.left.and.right")
|
Image(systemName: "dot.radiowaves.left.and.right")
|
||||||
}
|
}
|
||||||
.help("Discover Clawdis gateways on your LAN")
|
.help("Discover Clawdis bridges on your LAN")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,7 +60,8 @@ final class GatewayDiscoveryModel {
|
|||||||
let advertisedName = txt["displayName"]
|
let advertisedName = txt["displayName"]
|
||||||
.map(Self.prettifyInstanceName)
|
.map(Self.prettifyInstanceName)
|
||||||
.flatMap { $0.isEmpty ? nil : $0 }
|
.flatMap { $0.isEmpty ? nil : $0 }
|
||||||
let prettyName = advertisedName ?? Self.prettifyInstanceName(decodedName)
|
let prettyName =
|
||||||
|
advertisedName ?? Self.prettifyServiceName(decodedName)
|
||||||
|
|
||||||
var lanHost: String?
|
var lanHost: String?
|
||||||
var tailnetDns: String?
|
var tailnetDns: String?
|
||||||
@@ -177,6 +178,26 @@ final class GatewayDiscoveryModel {
|
|||||||
return stripped.trimmingCharacters(in: .whitespacesAndNewlines)
|
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(
|
static func isLocalGateway(
|
||||||
lanHost: String?,
|
lanHost: String?,
|
||||||
tailnetDns: String?,
|
tailnetDns: String?,
|
||||||
|
|||||||
@@ -279,7 +279,7 @@ struct OnboardingView: View {
|
|||||||
.font(.largeTitle.weight(.semibold))
|
.font(.largeTitle.weight(.semibold))
|
||||||
Text(
|
Text(
|
||||||
"Clawdis uses a single Gateway that stays running. Pick this Mac, " +
|
"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)
|
.font(.body)
|
||||||
.foregroundStyle(.secondary)
|
.foregroundStyle(.secondary)
|
||||||
.multilineTextAlignment(.center)
|
.multilineTextAlignment(.center)
|
||||||
@@ -323,12 +323,16 @@ struct OnboardingView: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if self.gatewayDiscovery.gateways.isEmpty {
|
if self.gatewayDiscovery.gateways.isEmpty {
|
||||||
Text("Searching for nearby gateways…")
|
Text("Searching for nearby bridges…")
|
||||||
.font(.caption)
|
.font(.caption)
|
||||||
.foregroundStyle(.secondary)
|
.foregroundStyle(.secondary)
|
||||||
.padding(.leading, 4)
|
.padding(.leading, 4)
|
||||||
} else {
|
} else {
|
||||||
VStack(alignment: .leading, spacing: 6) {
|
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
|
ForEach(self.gatewayDiscovery.gateways.prefix(6)) { gateway in
|
||||||
self.connectionChoiceButton(
|
self.connectionChoiceButton(
|
||||||
title: gateway.displayName,
|
title: gateway.displayName,
|
||||||
@@ -1336,7 +1340,7 @@ struct OnboardingView: View {
|
|||||||
if shouldMonitor, !self.monitoringDiscovery {
|
if shouldMonitor, !self.monitoringDiscovery {
|
||||||
self.monitoringDiscovery = true
|
self.monitoringDiscovery = true
|
||||||
Task { @MainActor in
|
Task { @MainActor in
|
||||||
try? await Task.sleep(nanoseconds: 250_000_000)
|
try? await Task.sleep(nanoseconds: 550_000_000)
|
||||||
guard self.monitoringDiscovery else { return }
|
guard self.monitoringDiscovery else { return }
|
||||||
self.gatewayDiscovery.start()
|
self.gatewayDiscovery.start()
|
||||||
await self.refreshLocalGatewayProbe()
|
await self.refreshLocalGatewayProbe()
|
||||||
|
|||||||
Reference in New Issue
Block a user