mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-05 13:50:22 +00:00
fix(android): use scheme default port for gateway setup URLs (#43540)
* fix(android): use scheme default port for gateway setup URLs * test(android): cover gateway endpoint default ports * fix(android): preserve direct gateway default port * fix(android): preserve explicit cleartext port display * fix: preserve Android gateway setup URL ports (#43540) (thanks @fmercurio) --------- Co-authored-by: clawdia <clawdia@fmercurio.tech> Co-authored-by: Ayaan Zaidi <hi@obviy.us>
This commit is contained in:
@@ -97,8 +97,25 @@ internal fun parseGatewayEndpoint(rawInput: String): GatewayEndpointConfig? {
|
||||
"wss", "https" -> true
|
||||
else -> true
|
||||
}
|
||||
val port = uri.port.takeIf { it in 1..65535 } ?: if (tls) 443 else 18789
|
||||
val displayUrl = "${if (tls) "https" else "http"}://$host:$port"
|
||||
val defaultPort =
|
||||
when (scheme) {
|
||||
"wss", "https" -> 443
|
||||
"ws", "http" -> 18789
|
||||
else -> 443
|
||||
}
|
||||
val displayPort =
|
||||
when (scheme) {
|
||||
"wss", "https" -> 443
|
||||
"ws", "http" -> 80
|
||||
else -> 443
|
||||
}
|
||||
val port = uri.port.takeIf { it in 1..65535 } ?: defaultPort
|
||||
val displayUrl =
|
||||
if (port == displayPort && defaultPort == displayPort) {
|
||||
"${if (tls) "https" else "http"}://$host"
|
||||
} else {
|
||||
"${if (tls) "https" else "http"}://$host:$port"
|
||||
}
|
||||
|
||||
return GatewayEndpointConfig(host = host, port = port, tls = tls, displayUrl = displayUrl)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user