diff --git a/cli-boot-wrapper.js b/cli-boot-wrapper.js index d4e93f5..2bf31f4 100755 --- a/cli-boot-wrapper.js +++ b/cli-boot-wrapper.js @@ -25,7 +25,7 @@ if (config.error) { const colors = require('colors'); console.clear(); console.log(colors.bold(` - v4.5.2 ____ _ + v4.5.3 ____ _ _ __ ___ / ___|| |_ _ __ ___ __ _ _ __ ___ | '_ \` _ \\\\___ \\| __| '__/ _ \\/ _\` | '_ \` _ \\ | | | | | |___) | |_| | | __/ (_| | | | | | | diff --git a/mstream-electron.js b/mstream-electron.js index 19a9eb8..b3ee3b8 100644 --- a/mstream-electron.js +++ b/mstream-electron.js @@ -89,19 +89,24 @@ function createMainWindow() { return; } - try{ - if(fs.statSync(fe.join(app.getPath('userData'), 'save/temp-boot-disable.json')).isFile()){ - var loadJson9 = JSON.parse(fs.readFileSync(fe.join(app.getPath('userData'), 'save/temp-boot-disable.json'), 'utf8')); - if(loadJson9.disable === false && fs.statSync(configFile).isFile()){ - var loadJson = JSON.parse(fs.readFileSync(configFile, 'utf8')); - bootServer(loadJson); - return; + let loadJson = false; + try { + if (fs.statSync(fe.join(app.getPath('userData'), 'save/temp-boot-disable.json')).isFile()) { + const loadJson9 = JSON.parse(fs.readFileSync(fe.join(app.getPath('userData'), 'save/temp-boot-disable.json'), 'utf8')); + if (loadJson9.disable === false && fs.statSync(configFile).isFile()) { + loadJson = JSON.parse(fs.readFileSync(configFile, 'utf8')); } } - }catch(error){ + } catch(error){ + loadJson = false; console.log('Failed To Load JSON'); } + if (loadJson) { + bootServer(loadJson); + return; + } + // Create the browser window. mainWindow = new BrowserWindow({ webPreferences: { nodeIntegration: true }, width: 850, height: 550, icon: fe.join(__dirname, '/electron/mstream-logo-cut.png') }); mainWindow.setMenu(null); @@ -132,7 +137,7 @@ function bootServer(program) { program.configFile = configFile; // Auto Boot - if ((program.autoboot && program.autoboot === true)) { + if (program.autoboot && program.autoboot === true) { mstreamAutoLaunch.enable(); fs.writeFileSync(fe.join(app.getPath('userData'), 'save/temp-boot-disable.json'), JSON.stringify({ disable: false }), 'utf8'); } @@ -186,7 +191,7 @@ function bootServer(program) { ]; // Check if Auto DNS is logged in - if(program.ddns.tested === true) { + if (program.ddns.tested === true) { trayTemplate[3].submenu.push({ type: 'separator' }); trayTemplate[3].submenu.push({ label: 'https://' + program.ddns.url, click: function () { diff --git a/package.json b/package.json index 0e0a2e5..f503896 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mstream", - "version": "4.5.2", + "version": "4.5.3", "description": "music streaming server", "main": "cli-boot-wrapper.js", "bin": {