openclaw-navigator 4.6.0 → 4.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.mjs +11 -28
- package/package.json +1 -1
package/cli.mjs
CHANGED
|
@@ -864,10 +864,9 @@ function handleRequest(req, res) {
|
|
|
864
864
|
}
|
|
865
865
|
|
|
866
866
|
// ── Reverse proxy: /ui/* → OC Web UI (localhost:ocUIPort) ──────────────
|
|
867
|
-
//
|
|
867
|
+
// Keep /ui prefix — Next.js basePath: "/ui" expects it
|
|
868
868
|
if (path === "/ui" || path.startsWith("/ui/")) {
|
|
869
|
-
const
|
|
870
|
-
const targetURL = `${targetPath}${url.search}`;
|
|
869
|
+
const targetURL = `${path}${url.search}`;
|
|
871
870
|
|
|
872
871
|
const proxyOpts = {
|
|
873
872
|
hostname: "127.0.0.1",
|
|
@@ -942,32 +941,16 @@ function handleRequest(req, res) {
|
|
|
942
941
|
return;
|
|
943
942
|
}
|
|
944
943
|
|
|
945
|
-
// ── Root →
|
|
944
|
+
// ── Root → redirect to /ui/ (Next.js basePath) or show bridge status ──
|
|
946
945
|
if (req.method === "GET" && path === "") {
|
|
947
946
|
// Quick probe to check if OC UI is running
|
|
948
947
|
const probe = httpRequest(
|
|
949
|
-
{ hostname: "127.0.0.1", port: ocUIPort, path: "/", method: "HEAD", timeout: 1000 },
|
|
948
|
+
{ hostname: "127.0.0.1", port: ocUIPort, path: "/ui/", method: "HEAD", timeout: 1000 },
|
|
950
949
|
(probeRes) => {
|
|
951
950
|
probeRes.resume(); // drain
|
|
952
|
-
// OC UI is running —
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
port: ocUIPort,
|
|
956
|
-
path: `/${url.search}`,
|
|
957
|
-
method: req.method,
|
|
958
|
-
headers: { ...req.headers, host: `127.0.0.1:${ocUIPort}` },
|
|
959
|
-
};
|
|
960
|
-
const rootProxy = httpRequest(rootProxyOpts, (rootRes) => {
|
|
961
|
-
const headers = { ...rootRes.headers };
|
|
962
|
-
headers["access-control-allow-origin"] = "*";
|
|
963
|
-
res.writeHead(rootRes.statusCode ?? 502, headers);
|
|
964
|
-
rootRes.pipe(res, { end: true });
|
|
965
|
-
});
|
|
966
|
-
rootProxy.on("error", () => {
|
|
967
|
-
res.writeHead(302, { Location: "/ui/" });
|
|
968
|
-
res.end();
|
|
969
|
-
});
|
|
970
|
-
rootProxy.end();
|
|
951
|
+
// OC UI is running — redirect to /ui/
|
|
952
|
+
res.writeHead(302, { Location: "/ui/" });
|
|
953
|
+
res.end();
|
|
971
954
|
},
|
|
972
955
|
);
|
|
973
956
|
probe.on("error", () => {
|
|
@@ -975,8 +958,8 @@ function handleRequest(req, res) {
|
|
|
975
958
|
sendJSON(res, 200, {
|
|
976
959
|
ok: true,
|
|
977
960
|
service: "openclaw-navigator-bridge",
|
|
978
|
-
version: "4.
|
|
979
|
-
ui: { available: false, port: ocUIPort, hint: "Start the OC
|
|
961
|
+
version: "4.6.0",
|
|
962
|
+
ui: { available: false, port: ocUIPort, hint: "Start the OC Web UI to enable /ui/" },
|
|
980
963
|
gateway: { port: ocGatewayPort },
|
|
981
964
|
navigator: { connected: bridgeState.connected },
|
|
982
965
|
});
|
|
@@ -986,7 +969,7 @@ function handleRequest(req, res) {
|
|
|
986
969
|
sendJSON(res, 200, {
|
|
987
970
|
ok: true,
|
|
988
971
|
service: "openclaw-navigator-bridge",
|
|
989
|
-
version: "4.
|
|
972
|
+
version: "4.6.0",
|
|
990
973
|
ui: { available: false, port: ocUIPort, hint: "OC UI timed out" },
|
|
991
974
|
});
|
|
992
975
|
});
|
|
@@ -1537,7 +1520,7 @@ module.exports = {
|
|
|
1537
1520
|
};
|
|
1538
1521
|
|
|
1539
1522
|
await Promise.all([
|
|
1540
|
-
checkPort("OC Web UI", ocUIPort, "/"),
|
|
1523
|
+
checkPort("OC Web UI", ocUIPort, "/ui/"),
|
|
1541
1524
|
checkPort("OC Gateway", ocGatewayPort, "/health"),
|
|
1542
1525
|
]);
|
|
1543
1526
|
|