From 7a6334d9207c434540a9b70acf74a06069b95dba Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sat, 13 Dec 2025 23:29:32 +0000 Subject: [PATCH] iOS: copy + clean bridge address --- apps/ios/Sources/Bridge/BridgeSession.swift | 24 +++++++++++++++++++-- apps/ios/Sources/Settings/SettingsTab.swift | 12 ++++++++++- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/apps/ios/Sources/Bridge/BridgeSession.swift b/apps/ios/Sources/Bridge/BridgeSession.swift index 4d0e11815..db3be5a8c 100644 --- a/apps/ios/Sources/Bridge/BridgeSession.swift +++ b/apps/ios/Sources/Bridge/BridgeSession.swift @@ -27,12 +27,32 @@ actor BridgeSession { private static func prettyRemoteEndpoint(_ endpoint: NWEndpoint) -> String? { switch endpoint { case let .hostPort(host, port): - "\(host):\(port)".replacingOccurrences(of: "::ffff:", with: "") + let hostString = Self.prettyHostString(host) + if hostString.contains(":") { + return "[\(hostString)]:\(port)" + } + return "\(hostString):\(port)" default: - String(describing: endpoint) + return String(describing: endpoint) } } + private static func prettyHostString(_ host: NWEndpoint.Host) -> String { + var hostString = String(describing: host) + hostString = hostString.replacingOccurrences(of: "::ffff:", with: "") + + guard let percentIndex = hostString.firstIndex(of: "%") else { return hostString } + + let prefix = hostString[..