- commit
- 5279601
- parent
- d2b625d
- author
- im_wower
- date
- 2026-03-22 12:27:41 +0800 CST
Migrate legacy controller base URL to live control API
1 files changed,
+15,
-1
+15,
-1
1@@ -165,6 +165,20 @@ function trimTrailingSlash(value) {
2 return String(value || "").trim().replace(/\/+$/u, "");
3 }
4
5+function normalizeSavedControlBaseUrl(value) {
6+ const normalized = trimTrailingSlash(value);
7+
8+ if (
9+ !normalized ||
10+ normalized === "http://127.0.0.1:9800" ||
11+ normalized === "http://localhost:9800"
12+ ) {
13+ return DEFAULT_CONTROL_BASE_URL;
14+ }
15+
16+ return normalized;
17+}
18+
19 function deriveControlBaseUrl(wsUrl) {
20 try {
21 const parsed = new URL(wsUrl || DEFAULT_WS_URL);
22@@ -1702,7 +1716,7 @@ async function init() {
23 if (state.wsUrl === "ws://localhost:9800") {
24 state.wsUrl = DEFAULT_WS_URL;
25 }
26- state.controlBaseUrl = trimTrailingSlash(saved[CONTROLLER_STORAGE_KEYS.controlBaseUrl]) || DEFAULT_CONTROL_BASE_URL;
27+ state.controlBaseUrl = normalizeSavedControlBaseUrl(saved[CONTROLLER_STORAGE_KEYS.controlBaseUrl]);
28 state.controlState = loadControlState(saved[CONTROLLER_STORAGE_KEYS.controlState]);
29
30 state.trackedTabs = loadTrackedTabs(