fix another electron boot bug

This commit is contained in:
IrosTheBeggar 2019-11-07 20:53:52 -05:00
parent 49554af23d
commit fccb009045
3 changed files with 17 additions and 12 deletions

View File

@ -25,7 +25,7 @@ if (config.error) {
const colors = require('colors');
console.clear();
console.log(colors.bold(`
v4.5.2 ____ _
v4.5.3 ____ _
_ __ ___ / ___|| |_ _ __ ___ __ _ _ __ ___
| '_ \` _ \\\\___ \\| __| '__/ _ \\/ _\` | '_ \` _ \\
| | | | | |___) | |_| | | __/ (_| | | | | | |

View File

@ -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 () {

View File

@ -1,6 +1,6 @@
{
"name": "mstream",
"version": "4.5.2",
"version": "4.5.3",
"description": "music streaming server",
"main": "cli-boot-wrapper.js",
"bin": {