Skip to content

Commit

Permalink
fix: bind phNode api server to localhost only to prevent windows fire…
Browse files Browse the repository at this point in the history
…wall dialog
  • Loading branch information
abose committed Dec 20, 2023
1 parent 488be13 commit 18bc2dd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src-node/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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}`);
Expand Down

0 comments on commit 18bc2dd

Please sign in to comment.