From 18bc2dda9ca437620403d01bd659eda13cddb89a Mon Sep 17 00:00:00 2001 From: abose Date: Wed, 20 Dec 2023 13:21:44 +0530 Subject: [PATCH] fix: bind phNode api server to localhost only to prevent windows firewall dialog --- src-node/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src-node/index.js b/src-node/index.js index 548b079a52..130d00176e 100644 --- a/src-node/index.js +++ b/src-node/index.js @@ -195,11 +195,12 @@ rl.on('line', (line) => { processCommand(line); }); +const localhostOnly = 'localhost'; function getFreePort() { return new Promise((resolve)=>{ const server = net.createServer(); - server.listen(0, () => { + server.listen(0, localhostOnly, () => { const port = server.address().port; server.close(() => { resolve(port); @@ -222,7 +223,7 @@ getFreePort().then((port) => { // PhoenixFS.setDebugMode(true); // uncomment this line to enable more logging in phoenix fs lib // Start the HTTP server on port 3000 - server.listen(port, () => { + server.listen(port, localhostOnly, () => { serverPortResolve(port); savedConsoleLog(`Server running on http://localhost:${port}`); savedConsoleLog(`Phoenix node tauri FS url is ws://localhost:${port}${PHOENIX_FS_URL}`);