diff --git a/main.js b/main.js index 906cd7a..4a28176 100644 --- a/main.js +++ b/main.js @@ -9,7 +9,7 @@ const electron = require('electron'), os = require('os'), spawn = require('child_process').spawn, exec = require('child_process').exec, - {Menu} = require("electron"), + { Menu } = require("electron"), fixPath = require('fix-path'); var express = require('express'), @@ -62,7 +62,14 @@ process.once('loaded', () => { }); guiapp.use(bodyParser.json({ limit: '50mb' })); // support json encoded bodies +<<<<<<< HEAD guiapp.use(bodyParser.urlencoded({ limit: '50mb', extended: true })); // support encoded bodies +======= +guiapp.use(bodyParser.urlencoded({ + limit: '50mb', + extended: true +})); // support encoded bodies +>>>>>>> 7486433f111614db47f4d49f4a2a77ecd5bfcd68 guiapp.get('/', function (req, res) { res.send('Iguana app server'); @@ -172,6 +179,7 @@ fs.copy(iguanaConfsDirSrc, iguanaConfsDir, function (err) { let mainWindow; let loadingWindow; +var isMainWindowExist; function createLoadingWindow() { mainWindow = null; @@ -196,7 +204,8 @@ function createLoadingWindow() { // putting them into an window_arr loadingWindow = null; createWindow('open'); - }) + isMainWindowExist = true; + }); //ca333 todo - add os detector to use correct binary - so we can use the same bundle on ALL OS platforms /*if (os.platform() === 'win32') { @@ -220,10 +229,8 @@ function createLoadingWindow() { app.on('ready', createLoadingWindow); - function createWindow (status) { - if ( status === 'open') { - + if ( status === 'open' && !isMainWindowExist) { require(path.join(__dirname, 'private/mainmenu')); // initialise window @@ -234,20 +241,20 @@ function createWindow (status) { }); const staticMenu = Menu.buildFromTemplate([ //if static - {role: 'copy'}, - {type: 'separator'}, - {role: 'selectall'}, + { role: 'copy' }, + { type: 'separator' }, + { role: 'selectall' }, ]) const editMenu = Menu.buildFromTemplate([ //if editable - {role: 'undo'}, - {role: 'redo'}, - {type: 'separator'}, - {role: 'cut'}, - {role: 'copy'}, - {role: 'paste'}, - {type: 'separator'}, - {role: 'selectall'}, + { role: 'undo' }, + { role: 'redo' }, + { type: 'separator' }, + { role: 'cut' }, + { role: 'copy' }, + { role: 'paste' }, + { type: 'separator' }, + { role: 'selectall' }, ]) // load our index.html (i.e. easyDEX GUI) @@ -259,6 +266,7 @@ function createWindow (status) { mainWindow.webContents.on('context-menu', (e, params) => { //context-menu returns params const { selectionText, isEditable } = params; //params obj + if (isEditable) { editMenu.popup(mainWindow); } else if (selectionText && selectionText.trim() !== '') { diff --git a/routes/shepherd.js b/routes/shepherd.js index f982b09..ef67f6e 100644 --- a/routes/shepherd.js +++ b/routes/shepherd.js @@ -1227,8 +1227,9 @@ shepherd.get('/kick', function(req, res, next) { var kickStartDirs = { 'soft': [ { - 'name': 'DB/[coin]/balancecrc.', - 'type': 'pattern' + 'name': 'DB/[coin]', + 'type': 'pattern', + 'match': 'balancecrc.' }, { 'name': 'DB/[coin]/utxoaddrs', @@ -1301,23 +1302,27 @@ shepherd.get('/kick', function(req, res, next) { if (_coin && _type) { for (var i = 0; i < kickStartDirs[_type].length; i++) { - console.log('deleting ' + kickStartDirs[_type][i].type + (kickStartDirs[_type][i].match ? ' ' + kickStartDirs[_type][i].match : '') + ' ' + iguanaDir + '/' + kickStartDirs[_type][i].name.replace('[coin]', _coin)); - if (kickStartDirs[_type][i].type === 'folder' || kickStartDirs[_type][i].type === 'file') { - rimraf(iguanaDir + '/' + kickStartDirs[_type][i].name.replace('[coin]', _coin), function(err) { + var currentKickItem = kickStartDirs[_type][i]; + + console.log('deleting ' + currentKickItem.type + (currentKickItem.match ? ' ' + currentKickItem.match : '') + ' ' + iguanaDir + '/' + currentKickItem.name.replace('[coin]', _coin)); + if (currentKickItem.type === 'folder' || currentKickItem.type === 'file') { + rimraf(iguanaDir + '/' + currentKickItem.name.replace('[coin]', _coin), function(err) { if (err) { throw err; } }); - } else if (kickStartDirs[_type][i].type === 'pattern') { - var dirItems = fs.readdirSync(iguanaDir + '/' + kickStartDirs[_type][i].name.replace('[coin]', _coin)); + } else if (currentKickItem.type === 'pattern') { + var dirItems = fs.readdirSync(iguanaDir + '/' + currentKickItem.name.replace('[coin]', _coin)); + if (dirItems && dirItems.length) { for (var j = 0; j < dirItems.length; j++) { - if (dirItems[j].indexOf(kickStartDirs[_type][i].match) > -1) { - rimraf(iguanaDir + '/' + kickStartDirs[_type][i].name.replace('[coin]', _coin) + '/' + dirItems[j], function(err) { + if (dirItems[j].indexOf(currentKickItem.match) > -1) { + rimraf(iguanaDir + '/' + currentKickItem.name.replace('[coin]', _coin) + '/' + dirItems[j], function(err) { if (err) { throw err; } }); + console.log('deleting ' + dirItems[j]); } } @@ -1859,7 +1864,7 @@ function setConf(flock) { } function getConf(flock) { - const komodoDir = '', + var komodoDir = '', ZcashDir = '', DaemonConfPath = '';