diff --git a/main.js b/main.js index 0d9cbe9..135b4c5 100644 --- a/main.js +++ b/main.js @@ -107,7 +107,7 @@ process.once('loaded', () => { process.setFdLimit(appConfig.maxDescriptors.darwin); app.setAboutPanelOptions({ applicationName: app.getName(), - applicationVersion: app.getVersion(), + applicationVersion: `app.getVersion().replace('version=', '')}-beta`, copyright: 'Released under the MIT license', credits: 'SuperNET Team' }) diff --git a/package.json b/package.json index 5c6f43f..d6085e6 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,7 @@ "portscanner": "^2.1.1", "ps-node": "^0.1.5", "remote-file-size": "^3.0.3", - "request": "^2.80.0" + "request": "^2.80.0", + "socket.io": "^1.7.3" } } diff --git a/routes/shepherd.js b/routes/shepherd.js index ce96364..a99766c 100644 --- a/routes/shepherd.js +++ b/routes/shepherd.js @@ -2496,16 +2496,16 @@ function setConf(flock) { return new Promise(function(resolve, reject) { const result = 'Check Conf file exists is done' - fs.ensureFile(DaemonConfPath, function(err) { - shepherd.log(err); // => null - }); - - setTimeout(function() { + const confFileExist = fs.ensureFileSync(DaemonConfPath); + if (confFileExist) { shepherd.log(result); shepherd.writeLog(`setconf ${result}`); resolve(result); - }, 2000); + } else { + shepherd.log('conf file doesnt exist'); + resolve('conf file doesnt exist'); + } }); } @@ -2514,13 +2514,10 @@ function setConf(flock) { const result = 'Conf file permissions updated to Read/Write'; fsnode.chmodSync(DaemonConfPath, '0666'); + shepherd.log(result); + shepherd.writeLog(`setconf ${result}`); - setTimeout(function() { - shepherd.log(result); - shepherd.writeLog(`setconf ${result}`); - - resolve(result); - }, 1000); + resolve(result); }); } @@ -2539,16 +2536,13 @@ function setConf(flock) { fs.writeFile(DaemonConfPath, rmlines, 'utf8', function(err) { if (err) return shepherd.log(err); + + fsnode.chmodSync(DaemonConfPath, '0666'); + shepherd.writeLog(`setconf ${result}`); + shepherd.log(result); + resolve(result); }); }); - - fsnode.chmodSync(DaemonConfPath, '0666'); - setTimeout(function() { - shepherd.writeLog(`setconf ${result}`); - shepherd.log(result); - - resolve(result); - }, 2000); }); } @@ -2565,7 +2559,7 @@ function setConf(flock) { shepherd.log('rpcuser: OK'); shepherd.writeLog('rpcuser: OK'); } else { - const randomstring = md5(Math.random() * Math.random() * 999); + const randomstring = md5((Math.random() * Math.random() * 999).toString()); shepherd.log('rpcuser: NOT FOUND'); shepherd.writeLog('rpcuser: NOT FOUND'); @@ -2593,7 +2587,7 @@ function setConf(flock) { shepherd.log('rpcpassword: OK'); shepherd.writeLog('rpcpassword: OK'); } else { - var randomstring = md5(Math.random() * Math.random() * 999); + var randomstring = md5((Math.random() * Math.random() * 999).toString()); shepherd.log('rpcpassword: NOT FOUND'); shepherd.writeLog('rpcpassword: NOT FOUND'); @@ -2705,27 +2699,10 @@ function setConf(flock) { .then(addnode); }); - setTimeout(function() { - shepherd.log(result); - shepherd.writeLog(`checkconf addnode ${result}`); - - resolve(result); - }, 2000); - }); - } + shepherd.log(result); + shepherd.writeLog(`checkconf addnode ${result}`); - const MakeConfReadOnly = function() { - return new Promise(function(resolve, reject) { - const result = 'Conf file permissions updated to Read Only'; - - fsnode.chmodSync(DaemonConfPath, '0400'); - - setTimeout(function() { - shepherd.log(result); - shepherd.writeLog(`MakeConfReadOnly ${result}`); - - resolve(result); - }, 1000); + resolve(result); }); }