Browse Source

Merge pull request #56 from pbca26/master

fixed main window cloning issue; shepherd api bug fix
all-modes
Satinder Grewal 8 years ago
committed by GitHub
parent
commit
9c1e93a653
  1. 40
      main.js
  2. 25
      routes/shepherd.js

40
main.js

@ -9,7 +9,7 @@ const electron = require('electron'),
os = require('os'), os = require('os'),
spawn = require('child_process').spawn, spawn = require('child_process').spawn,
exec = require('child_process').exec, exec = require('child_process').exec,
{Menu} = require("electron"), { Menu } = require("electron"),
fixPath = require('fix-path'); fixPath = require('fix-path');
var express = require('express'), var express = require('express'),
@ -61,8 +61,11 @@ process.once('loaded', () => {
} }
}); });
guiapp.use(bodyParser.json({limit: '50mb'})); // support json encoded bodies guiapp.use(bodyParser.json({ limit: '50mb' })); // support json encoded bodies
guiapp.use(bodyParser.urlencoded({limit: '50mb', extended: true})); // support encoded bodies guiapp.use(bodyParser.urlencoded({
limit: '50mb',
extended: true
})); // support encoded bodies
guiapp.get('/', function (req, res) { guiapp.get('/', function (req, res) {
res.send('Iguana app server'); res.send('Iguana app server');
@ -172,6 +175,7 @@ fs.copy(iguanaConfsDirSrc, iguanaConfsDir, function (err) {
let mainWindow; let mainWindow;
let loadingWindow; let loadingWindow;
var isMainWindowExist;
function createLoadingWindow() { function createLoadingWindow() {
mainWindow = null; mainWindow = null;
@ -196,7 +200,8 @@ function createLoadingWindow() {
// putting them into an window_arr // putting them into an window_arr
loadingWindow = null; loadingWindow = null;
createWindow('open'); createWindow('open');
}) isMainWindowExist = true;
});
//ca333 todo - add os detector to use correct binary - so we can use the same bundle on ALL OS platforms //ca333 todo - add os detector to use correct binary - so we can use the same bundle on ALL OS platforms
/*if (os.platform() === 'win32') { /*if (os.platform() === 'win32') {
@ -220,10 +225,8 @@ function createLoadingWindow() {
app.on('ready', createLoadingWindow); app.on('ready', createLoadingWindow);
function createWindow (status) { function createWindow (status) {
if ( status === 'open') { if ( status === 'open' && !isMainWindowExist) {
require(path.join(__dirname, 'private/mainmenu')); require(path.join(__dirname, 'private/mainmenu'));
// initialise window // initialise window
@ -234,20 +237,20 @@ function createWindow (status) {
}); });
const staticMenu = Menu.buildFromTemplate([ //if static const staticMenu = Menu.buildFromTemplate([ //if static
{role: 'copy'}, { role: 'copy' },
{type: 'separator'}, { type: 'separator' },
{role: 'selectall'}, { role: 'selectall' },
]) ])
const editMenu = Menu.buildFromTemplate([ //if editable const editMenu = Menu.buildFromTemplate([ //if editable
{role: 'undo'}, { role: 'undo' },
{role: 'redo'}, { role: 'redo' },
{type: 'separator'}, { type: 'separator' },
{role: 'cut'}, { role: 'cut' },
{role: 'copy'}, { role: 'copy' },
{role: 'paste'}, { role: 'paste' },
{type: 'separator'}, { type: 'separator' },
{role: 'selectall'}, { role: 'selectall' },
]) ])
// load our index.html (i.e. easyDEX GUI) // load our index.html (i.e. easyDEX GUI)
@ -259,6 +262,7 @@ function createWindow (status) {
mainWindow.webContents.on('context-menu', (e, params) => { //context-menu returns params mainWindow.webContents.on('context-menu', (e, params) => { //context-menu returns params
const { selectionText, isEditable } = params; //params obj const { selectionText, isEditable } = params; //params obj
if (isEditable) { if (isEditable) {
editMenu.popup(mainWindow); editMenu.popup(mainWindow);
} else if (selectionText && selectionText.trim() !== '') { } else if (selectionText && selectionText.trim() !== '') {

25
routes/shepherd.js

@ -1227,8 +1227,9 @@ shepherd.get('/kick', function(req, res, next) {
var kickStartDirs = { var kickStartDirs = {
'soft': [ 'soft': [
{ {
'name': 'DB/[coin]/balancecrc.', 'name': 'DB/[coin]',
'type': 'pattern' 'type': 'pattern',
'match': 'balancecrc.'
}, },
{ {
'name': 'DB/[coin]/utxoaddrs', 'name': 'DB/[coin]/utxoaddrs',
@ -1301,23 +1302,27 @@ shepherd.get('/kick', function(req, res, next) {
if (_coin && _type) { if (_coin && _type) {
for (var i = 0; i < kickStartDirs[_type].length; i++) { 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)); var currentKickItem = kickStartDirs[_type][i];
if (kickStartDirs[_type][i].type === 'folder' || kickStartDirs[_type][i].type === 'file') {
rimraf(iguanaDir + '/' + kickStartDirs[_type][i].name.replace('[coin]', _coin), function(err) { 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) { if (err) {
throw err; throw err;
} }
}); });
} else if (kickStartDirs[_type][i].type === 'pattern') { } else if (currentKickItem.type === 'pattern') {
var dirItems = fs.readdirSync(iguanaDir + '/' + kickStartDirs[_type][i].name.replace('[coin]', _coin)); var dirItems = fs.readdirSync(iguanaDir + '/' + currentKickItem.name.replace('[coin]', _coin));
if (dirItems && dirItems.length) { if (dirItems && dirItems.length) {
for (var j = 0; j < dirItems.length; j++) { for (var j = 0; j < dirItems.length; j++) {
if (dirItems[j].indexOf(kickStartDirs[_type][i].match) > -1) { if (dirItems[j].indexOf(currentKickItem.match) > -1) {
rimraf(iguanaDir + '/' + kickStartDirs[_type][i].name.replace('[coin]', _coin) + '/' + dirItems[j], function(err) { rimraf(iguanaDir + '/' + currentKickItem.name.replace('[coin]', _coin) + '/' + dirItems[j], function(err) {
if (err) { if (err) {
throw err; throw err;
} }
}); });
console.log('deleting ' + dirItems[j]); console.log('deleting ' + dirItems[j]);
} }
} }
@ -1859,7 +1864,7 @@ function setConf(flock) {
} }
function getConf(flock) { function getConf(flock) {
const komodoDir = '', var komodoDir = '',
ZcashDir = '', ZcashDir = '',
DaemonConfPath = ''; DaemonConfPath = '';

Loading…
Cancel
Save