mirror of
https://github.com/Tencent/BrowserSkill.git
synced 2026-09-10 13:01:23 +08:00
Merge pull request #13 from zjxzjw/fix2
config(extension): 配置WebSocket连接URL为构建时变量
This commit is contained in:
@@ -31,12 +31,9 @@ import { detectBrowserMeta } from "@/transport/handshake";
|
||||
import type { Transport } from "@/transport/transport";
|
||||
import { WSTransport } from "@/transport/ws-transport";
|
||||
|
||||
export const DEFAULT_DAEMON_PORT = 52800;
|
||||
|
||||
export default defineBackground(() => {
|
||||
const port = DEFAULT_DAEMON_PORT;
|
||||
const controller = new ConnectionController();
|
||||
const transport = new WSTransport({ url: `ws://127.0.0.1:${port}` });
|
||||
const transport = new WSTransport({ url: __BSK_DAEMON_WS_URL__ });
|
||||
const sessions = new SessionManager();
|
||||
const cdp = new ChromiumCdp();
|
||||
const sessionsLive = attachSessionsLiveFlag({ manager: sessions });
|
||||
|
||||
@@ -5,3 +5,10 @@
|
||||
// at runtime (review M3 fix to round-1).
|
||||
|
||||
declare const __BSK_EXT_VERSION__: string;
|
||||
|
||||
/**
|
||||
* WebSocket URL the extension uses to connect to the local bsk daemon.
|
||||
* Defaults to {@code ws://127.0.0.1:52800}. Override at build time by
|
||||
* setting the {@code BSK_DAEMON_WS_URL} environment variable.
|
||||
*/
|
||||
declare const __BSK_DAEMON_WS_URL__: string;
|
||||
|
||||
@@ -21,6 +21,9 @@ export default defineConfig({
|
||||
},
|
||||
define: {
|
||||
__BSK_EXT_VERSION__: JSON.stringify(pkg.version),
|
||||
__BSK_DAEMON_WS_URL__: JSON.stringify(
|
||||
process.env.BSK_DAEMON_WS_URL ?? "ws://127.0.0.1:52800",
|
||||
),
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
|
||||
@@ -59,6 +59,9 @@ export default defineConfig({
|
||||
],
|
||||
define: {
|
||||
__BSK_EXT_VERSION__: JSON.stringify(EXTENSION_VERSION),
|
||||
__BSK_DAEMON_WS_URL__: JSON.stringify(
|
||||
process.env.BSK_DAEMON_WS_URL ?? "ws://127.0.0.1:52800",
|
||||
),
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
|
||||
Reference in New Issue
Block a user