Pass host environment variable to plugin runtime

https://feedback.yaak.app/p/when-i-use-clash-yaak-fails-to-launch
This commit is contained in:
Gregory Schier
2025-11-03 06:02:18 -08:00
parent f3e44c53d7
commit 1d158082f6
2 changed files with 7 additions and 1 deletions

View File

@@ -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<string, PluginHandle> = {};
const ws = new WebSocket(`ws://localhost:${port}`);
const ws = new WebSocket(`ws://${host}:${port}`);
ws.on('message', async (e: Buffer) => {
try {