Browse Source

fixed a bug in shepherd kick api

all-modes
pbca26 8 years ago
parent
commit
8648077088
  1. 31
      main.js
  2. 23
      routes/shepherd.js

31
main.js

@ -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');
@ -196,7 +199,7 @@ function createLoadingWindow() {
// putting them into an window_arr // putting them into an window_arr
loadingWindow = null; loadingWindow = null;
createWindow('open'); createWindow('open');
}) });
//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') {
@ -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)

23
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]);
} }
} }

Loading…
Cancel
Save