diff --git a/gui/init.js b/gui/init.js index 251c7f4..84932e4 100644 --- a/gui/init.js +++ b/gui/init.js @@ -15,11 +15,6 @@ $(document).ready(function() { if (appConf && !appConf.manualIguanaStart) { StartIguana(); } - /*if (appConf && appConf.forks && appConf.forks.basilisk) { - setTimeout(function() { - StartBasiliskInstance(); - }, 4000); - }*/ var portcheck; @@ -30,6 +25,11 @@ $(document).ready(function() { if (result !== 'error') { stopcheck(); + + if (appConf && appConf.forks && appConf.forks.basilisk) { + StartIguana_Cache(); + } + $('#loading_status_text').text('Connecting to Basilisk Network...'); EDEX_DEXgetinfoAll(appConf.skipBasiliskNetworkCheck, appConf.minNotaries); } diff --git a/gui/loading.js b/gui/loading.js index 90701db..96c571b 100644 --- a/gui/loading.js +++ b/gui/loading.js @@ -65,28 +65,21 @@ function StartIguana() { }); } -function StartBasiliskInstance() { - var ajax_data = { 'name': 'basilisk'}; - - console.log(ajax_data); - $.ajax({ - type: 'POST', - data: JSON.stringify(ajax_data), - url: 'http://127.0.0.1:17777/shepherd/forks', - dataType: 'xml/html/script/json', // expected format for response - contentType: 'application/json', // send as JSON - success: function(data, textStatus, jqXHR) { - var AjaxOutputData = JSON.parse(data); - console.log('== Shepherd Forks Data OutPut =='); - console.log(AjaxOutputData); - }, - error: function(xhr, textStatus, error) { - console.log(xhr.statusText); - if ( xhr.readyState == 0 ) { - } - console.log(textStatus); - console.log(error); - } +function StartIguana_Cache() { + var ajax_data = { + 'mode': 'basilisk', + 'coin': 'all' + }; + var start_iguana_cache= $.ajax({ + type: 'POST', + data: JSON.stringify(ajax_data), + url: 'http://127.0.0.1:17777/shepherd/forks', + contentType: 'application/json', // send as JSON + }) + start_iguana_cache.done(function(data) { + _data = JSON.parse(data); + console.log(_data.result); + sessionStorage.setItem('IguanaCachePort', _data.result); }); } diff --git a/main.js b/main.js index 68b30d7..ce3cdc5 100644 --- a/main.js +++ b/main.js @@ -21,7 +21,7 @@ var express = require('express'), pm2 = require('pm2'), cluster = require('cluster'), numCPUs = require('os').cpus().length, - kmdcli = require('./private/kmdcli.js'), + coincli = require('./private/coincli.js'), ipc = require('electron').ipcMain; Promise = require('bluebird'); @@ -240,14 +240,35 @@ function createLoadingWindow() { } }); -ipc.on('invokeAction', function(event, data){ - //console.log(data); - kmdcli.command(data, function(err, command) { - //console.log(command); - var result = command; - event.sender.send('kmdcliReply', result); + /* + * var ipc = require('electron').ipcRenderer; + * ipc.once('coincliReply', function(event, response){ + * console.log(response); + * }); + * ipc.send('InvokeCoinCliAction', '{"cli":"kmd","command":"getinfo"}'); + */ + + ipc.on('InvokeCoinCliAction', function(event, data){ + console.log(JSON.stringify(data)); + console.log(data.cli) + console.log(data.command) + + if (data.cli == 'kmd') { + coincli.kmdcommand(data.command, function(err, command) { + //console.log(command); + var result = command; + event.sender.send('coincliReply', result); + }); + } + if (data.cli == 'zec') { + coincli.zeccommand(data.command, function(err, command) { + //console.log(command); + var result = command; + event.sender.send('coincliReply', result); + }); + } }); -}); + //ca333 todo - add os detector to use correct binary - so we can use the same bundle on ALL OS platforms /*if (os.platform() === 'win32') { process.chdir(iguanaDir); diff --git a/routes/shepherd.js b/routes/shepherd.js index db4080b..6c6f42a 100644 --- a/routes/shepherd.js +++ b/routes/shepherd.js @@ -23,7 +23,7 @@ Promise = require('bluebird'); const fixPath = require('fix-path'); var ps = require('ps-node'), setconf = require('../private/setconf.js'), - kmdcli = require('../private/kmdcli.js'), + coincli = require('../private/coincli.js'), assetChainPorts = require('./ports.js') shepherd = express.Router(), iguanaInstanceRegistry = {};