mirror of
https://github.com/farcasclaudiu/openclaw.git
synced 2026-06-28 15:01:41 +03:00
fix(macos): resolve dashboard basePath for local and remote (#15862)
Co-authored-by: 帅小呆1号 <shuaixiaodai1@openclaw.ai>
This commit is contained in:
@@ -176,6 +176,48 @@ import Testing
|
||||
#expect(host == "192.168.1.10")
|
||||
}
|
||||
|
||||
@Test func dashboardURLUsesLocalBasePathInLocalMode() throws {
|
||||
let config: GatewayConnection.Config = (
|
||||
url: try #require(URL(string: "ws://127.0.0.1:18789")),
|
||||
token: nil,
|
||||
password: nil
|
||||
)
|
||||
|
||||
let url = try GatewayEndpointStore.dashboardURL(
|
||||
for: config,
|
||||
mode: .local,
|
||||
localBasePath: " control ")
|
||||
#expect(url.absoluteString == "http://127.0.0.1:18789/control/")
|
||||
}
|
||||
|
||||
@Test func dashboardURLSkipsLocalBasePathInRemoteMode() throws {
|
||||
let config: GatewayConnection.Config = (
|
||||
url: try #require(URL(string: "ws://gateway.example:18789")),
|
||||
token: nil,
|
||||
password: nil
|
||||
)
|
||||
|
||||
let url = try GatewayEndpointStore.dashboardURL(
|
||||
for: config,
|
||||
mode: .remote,
|
||||
localBasePath: "/local-ui")
|
||||
#expect(url.absoluteString == "http://gateway.example:18789/")
|
||||
}
|
||||
|
||||
@Test func dashboardURLPrefersPathFromConfigURL() throws {
|
||||
let config: GatewayConnection.Config = (
|
||||
url: try #require(URL(string: "wss://gateway.example:443/remote-ui")),
|
||||
token: nil,
|
||||
password: nil
|
||||
)
|
||||
|
||||
let url = try GatewayEndpointStore.dashboardURL(
|
||||
for: config,
|
||||
mode: .remote,
|
||||
localBasePath: "/local-ui")
|
||||
#expect(url.absoluteString == "https://gateway.example:443/remote-ui/")
|
||||
}
|
||||
|
||||
@Test func normalizeGatewayUrlAddsDefaultPortForWs() {
|
||||
let url = GatewayRemoteConfig.normalizeGatewayUrl("ws://gateway")
|
||||
#expect(url?.port == 18789)
|
||||
|
||||
Reference in New Issue
Block a user