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.urlencoded({limit: '50mb', extended: true})); // support encoded bodies
guiapp.use(bodyParser.json({ limit: '50mb' })); // support json encoded bodies
guiapp.use(bodyParser.urlencoded({
limit: '50mb',
extended: true
})); // support encoded bodies
guiapp.get('/', function (req, res) {
res.send('Iguana app server');
@ -196,7 +199,7 @@ function createLoadingWindow() {
// putting them into an window_arr
loadingWindow = null;
createWindow('open');
})
});
//ca333 todo - add os detector to use correct binary - so we can use the same bundle on ALL OS platforms
/*if (os.platform() === 'win32') {
@ -234,20 +237,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)

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

Loading…
Cancel
Save