mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 13:11:22 +00:00
refactor: route browser control via gateway/node
This commit is contained in:
@@ -4,6 +4,7 @@ import express from "express";
|
||||
|
||||
import type { ResolvedBrowserConfig } from "./config.js";
|
||||
import { registerBrowserRoutes } from "./routes/index.js";
|
||||
import type { BrowserRouteRegistrar } from "./routes/types.js";
|
||||
import {
|
||||
type BrowserServerState,
|
||||
createBrowserRouteContext,
|
||||
@@ -50,7 +51,7 @@ export async function startBrowserBridgeServer(params: {
|
||||
getState: () => state,
|
||||
onEnsureAttachTarget: params.onEnsureAttachTarget,
|
||||
});
|
||||
registerBrowserRoutes(app, ctx);
|
||||
registerBrowserRoutes(app as unknown as BrowserRouteRegistrar, ctx);
|
||||
|
||||
const server = await new Promise<Server>((resolve, reject) => {
|
||||
const s = app.listen(port, host, () => resolve(s));
|
||||
@@ -61,11 +62,9 @@ export async function startBrowserBridgeServer(params: {
|
||||
const resolvedPort = address?.port ?? port;
|
||||
state.server = server;
|
||||
state.port = resolvedPort;
|
||||
state.resolved.controlHost = host;
|
||||
state.resolved.controlPort = resolvedPort;
|
||||
state.resolved.controlUrl = `http://${host}:${resolvedPort}`;
|
||||
|
||||
const baseUrl = state.resolved.controlUrl;
|
||||
const baseUrl = `http://${host}:${resolvedPort}`;
|
||||
return { server, port: resolvedPort, baseUrl, state };
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user