aboutsummaryrefslogtreecommitdiffstats
path: root/src/electron/ipc-api
diff options
context:
space:
mode:
authorLibravatar Vijay A <avijayr@protonmail.com>2021-08-09 21:31:46 +0530
committerLibravatar Vijay Raghavan Aravamudhan <vraravam@users.noreply.github.com>2021-08-09 16:21:54 +0000
commit8b2d3db622d1087d0e2e6dee4f1ee202bd6bd767 (patch)
tree349cfc6c80559767845af61ef1b19e7191199053 /src/electron/ipc-api
parentchore: upgraded 'electron-builder' to '22.12.0' (diff)
downloadferdium-app-8b2d3db622d1087d0e2e6dee4f1ee202bd6bd767.tar.gz
ferdium-app-8b2d3db622d1087d0e2e6dee4f1ee202bd6bd767.tar.zst
ferdium-app-8b2d3db622d1087d0e2e6dee4f1ee202bd6bd767.zip
feat: added new Help menu item to allow easy import/export of config data
Diffstat (limited to 'src/electron/ipc-api')
-rw-r--r--src/electron/ipc-api/localServer.js8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/electron/ipc-api/localServer.js b/src/electron/ipc-api/localServer.js
index 1ed4b7167..591e70504 100644
--- a/src/electron/ipc-api/localServer.js
+++ b/src/electron/ipc-api/localServer.js
@@ -1,11 +1,9 @@
1import { ipcMain } from 'electron'; 1import { ipcMain } from 'electron';
2import net from 'net'; 2import net from 'net';
3import { LOCAL_HOSTNAME } from '../../config'; 3import { LOCAL_HOSTNAME, LOCAL_PORT } from '../../config';
4import { userDataPath } from '../../environment'; 4import { userDataPath } from '../../environment';
5import startServer from '../../internal-server/start'; 5import startServer from '../../internal-server/start';
6 6
7const DEFAULT_PORT = 45569;
8
9const portInUse = function (port) { 7const portInUse = function (port) {
10 return new Promise((resolve) => { 8 return new Promise((resolve) => {
11 const server = net.createServer((socket) => { 9 const server = net.createServer((socket) => {
@@ -30,10 +28,10 @@ export default (params) => {
30 ipcMain.on('startLocalServer', () => { 28 ipcMain.on('startLocalServer', () => {
31 if (!localServerStarted) { 29 if (!localServerStarted) {
32 // Find next unused port for server 30 // Find next unused port for server
33 let port = DEFAULT_PORT; 31 let port = LOCAL_PORT;
34 (async () => { 32 (async () => {
35 // eslint-disable-next-line no-await-in-loop 33 // eslint-disable-next-line no-await-in-loop
36 while ((await portInUse(port)) && port < DEFAULT_PORT + 10) { 34 while ((await portInUse(port)) && port < LOCAL_PORT + 10) {
37 port += 1; 35 port += 1;
38 } 36 }
39 console.log('Starting local server on port', port); 37 console.log('Starting local server on port', port);