diff --git a/main.js b/main.js index 3582bdeb3..cc466d8eb 100644 --- a/main.js +++ b/main.js @@ -1612,6 +1612,8 @@ if (!gotTheLock) { }) app.on('before-quit', function (e) { + mainWindow = null + view = null if (isMac()) { app.exit() } @@ -1619,6 +1621,8 @@ if (!gotTheLock) { }) app.on('quit', function () { + mainWindow = null + view = null tray.quit() }) } diff --git a/package.json b/package.json index fbd36e436..18f9460ee 100644 --- a/package.json +++ b/package.json @@ -7,9 +7,9 @@ "start": "electron .", "rebuild": "electron-rebuild -f", "postinstall": "npx electron-builder install-app-deps", - "deploy:win": "npx electron-builder --win --config electron-builder-deploy64.yml", - "deploy:mac": "npx electron-builder --mac --config electron-builder-deploy64.yml", - "deploy:lin": "npx electron-builder --linux --config electron-builder-deploy64.yml", + "build:win": "npx electron-builder --win --config electron-builder-deploy64.yml", + "build:mac": "npx electron-builder --mac --config electron-builder-deploy64.yml", + "build:lin": "npx electron-builder --linux --config electron-builder-deploy64.yml", "publish:win": "npx electron-builder --win -p always --config electron-builder64.yml", "publish:mac": "npx electron-builder --mac -p always --config electron-builder64.yml", "publish:lin": "npx electron-builder --linux -p always --config electron-builder64.yml" diff --git a/src/providers/companionServer.js b/src/providers/companionServer.js index 21c61414d..cab10b633 100644 --- a/src/providers/companionServer.js +++ b/src/providers/companionServer.js @@ -5,13 +5,12 @@ const networkInterfaces = os.networkInterfaces() const qrcode = require('qrcode-generator') const infoPlayerProvider = require('../providers/infoPlayerProvider') const settingsProvider = require('../providers/settingsProvider') -const { deprecate } = require('util') const ip = '0.0.0.0' const port = 9863 const hostname = os.hostname() -const pattIgnoreInterface = /(virtual|wsl|vEthernet|Default Switch|VMware|Adapter)\w*/gim +const pattIgnoreInterface = /(Loopback|virtual|wsl|vEthernet|Default Switch|VMware|Adapter|Hamachi)\w*/gim let totalConnections = 0 let timerTotalConections @@ -34,7 +33,20 @@ function infoServer() { } function fetchNetworkInterfaces() { - Object.keys(networkInterfaces).forEach((v, k) => { + serverInterfaces = Object.entries(networkInterfaces) + .filter(([interfaces]) => !pattIgnoreInterface.test(interfaces)) + .map(([name, value]) => { + value = value.filter((data) => { + return data.family == 'IPv4' && data.internal == false + }) + return { + name: name, + ip: value[0].address, + isProtected: infoServer().isProtected, + } + }) + + /*Object.keys(networkInterfaces).forEach((v, k) => { if (!pattIgnoreInterface.test(v)) { networkInterfaces[v].forEach((vv, kk) => { if (vv.family == 'IPv4' && vv.internal == false) { @@ -47,15 +59,17 @@ function fetchNetworkInterfaces() { } }) } - }) + })*/ } var serverFunction = function (req, res) { if (req.url === '/') { - var collection = '' + let collection = '' + let isProtected = infoServer().isProtected serverInterfaces.forEach((value) => { - let qr = qrcode(6, 'H') + let qr = qrcode(0, 'H') + value['hostname'] = hostname qr.addData(JSON.stringify(value)) qr.make() @@ -88,7 +102,6 @@ var serverFunction = function (req, res) { res.setHeader('Access-Control-Allow-Origin', '*') res.writeHead(200) - let isProtected = infoServer().isProtected res.write(`