Merge pull request #13 from zjxzjw/fix2

config(extension): 配置WebSocket连接URL为构建时变量
This commit is contained in:
BB-fat
2026-07-10 00:30:40 +08:00
committed by GitHub
4 changed files with 14 additions and 4 deletions
+1 -4
View File
@@ -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 });
+7
View File
@@ -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;
+3
View File
@@ -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: {
+3
View File
@@ -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: {