From 1d158082f69d76f4f150a492a56f0c0c69687ad6 Mon Sep 17 00:00:00 2001 From: Gregory Schier Date: Mon, 3 Nov 2025 06:02:18 -0800 Subject: [PATCH] Pass host environment variable to plugin runtime https://feedback.yaak.app/p/when-i-use-clash-yaak-fails-to-launch --- packages/plugin-runtime/src/index.ts | 7 ++++++- src-tauri/yaak-plugins/src/nodejs.rs | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/plugin-runtime/src/index.ts b/packages/plugin-runtime/src/index.ts index e2c08afc..d6c0c626 100644 --- a/packages/plugin-runtime/src/index.ts +++ b/packages/plugin-runtime/src/index.ts @@ -8,10 +8,15 @@ if (!port) { throw new Error('Plugin runtime missing PORT') } +const host = process.env.HOST; +if (!host) { + throw new Error('Plugin runtime missing HOST') +} + const pluginToAppEvents = new EventChannel(); const plugins: Record = {}; -const ws = new WebSocket(`ws://localhost:${port}`); +const ws = new WebSocket(`ws://${host}:${port}`); ws.on('message', async (e: Buffer) => { try { diff --git a/src-tauri/yaak-plugins/src/nodejs.rs b/src-tauri/yaak-plugins/src/nodejs.rs index 0a048074..cd706b8c 100644 --- a/src-tauri/yaak-plugins/src/nodejs.rs +++ b/src-tauri/yaak-plugins/src/nodejs.rs @@ -24,6 +24,7 @@ pub async fn start_nodejs_plugin_runtime( let cmd = app .shell() .sidecar("yaaknode")? + .env("HOST", addr.ip().to_string()) .env("PORT", addr.port().to_string()) .args(&[&plugin_runtime_main]);