Auto detect server

This commit is contained in:
Myx
2022-07-28 01:20:23 +02:00
parent 4ae248dfa0
commit fe1c572a68
35 changed files with 53196 additions and 47 deletions

View File

@@ -5,12 +5,12 @@ const cors = require('cors');
const AutoLaunch = require('auto-launch');
const server = express();
const ip = require('ip');
const macaddress = require('macaddress');
const firstRun = require('electron-first-run');
const bonjour = require('bonjour')()
const autoLaunch = new AutoLaunch({
name: 'GoToBed Server',
path: process.env.PORTABLE_EXECUTABLE_DIR + '/GoToBed.exe',
});
const paramPort = app.commandLine.getSwitchValue("port") == "" ? "3000" : app.commandLine.getSwitchValue("port");
const isFirstRun = firstRun();
@@ -101,6 +101,10 @@ server.post('/commandbridge', function (req, res) {
}})
app.on('ready', async () => {
macaddress.one().then(function (mac) {
bonjour.publish({ name: 'GoToBed-Server', type: 'http', port: paramPort, txt: mac})
});
if(isFirstRun) {
const firstSetup = dialog.showMessageBox(null, options);
console.log(firstSetup);