fix(openclaw controller): use buildOpenClawControlUiUrl for generating gateway URLs (#493)
This commit is contained in:
17
electron/utils/openclaw-control-ui.ts
Normal file
17
electron/utils/openclaw-control-ui.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* Build the external OpenClaw Control UI URL.
|
||||
*
|
||||
* OpenClaw 2026.3.13 imports one-time auth tokens from the URL fragment
|
||||
* (`#token=...`) and strips them after load. Query-string tokens are removed
|
||||
* by the UI bootstrap but are not imported for auth.
|
||||
*/
|
||||
export function buildOpenClawControlUiUrl(port: number, token: string): string {
|
||||
const url = new URL(`http://127.0.0.1:${port}/`);
|
||||
const trimmedToken = token.trim();
|
||||
|
||||
if (trimmedToken) {
|
||||
url.hash = new URLSearchParams({ token: trimmedToken }).toString();
|
||||
}
|
||||
|
||||
return url.toString();
|
||||
}
|
||||
Reference in New Issue
Block a user