Browse Source

added min notaries initial query limit

all-modes
pbca26 8 years ago
parent
commit
ed464cd999
  1. 49
      gui/init.js
  2. 19
      gui/loading.js
  3. 6
      main.js
  4. 17
      routes/shepherd.js

49
gui/init.js

@ -15,32 +15,27 @@ $(document).ready(function() {
StartIguana(); StartIguana();
} }
if (appConf && !appConf.skipBasiliskNetworkCheck) { var portcheck;
var portcheck;
function sartcheck() {
function sartcheck() { portcheck = setInterval(function(){
portcheck = setInterval(function(){ Iguana_activehandle().then(function(result){
Iguana_activehandle().then(function(result){ console.log(result);
console.log(result);
if (result !== 'error') {
if (result !== 'error') { stopcheck();
stopcheck(); $('#loading_status_text').text('Connecting to Basilisk Network...');
$('#loading_status_text').text('Connecting to Basilisk Network...'); EDEX_DEXgetinfoAll(appConf.skipBasiliskNetworkCheck, appConf.minNotaries);
EDEX_DEXgetinfoAll(); }
} })
}) //var check = Iguana_activehandle();
//var check = Iguana_activehandle(); //console.log(check[0])
//console.log(check[0]) }, 2000);
}, 2000);
}
function stopcheck() {
clearInterval(portcheck);
}
sartcheck();
//setTimeout(function(){ window.close(); }, 15000);
} else {
window.hide();
} }
function stopcheck() {
clearInterval(portcheck);
}
sartcheck();
}); });

19
gui/loading.js

@ -108,7 +108,11 @@ function EDEX_DEXnotarychains() {
}); });
} }
function EDEX_DEXgetinfoAll() { function EDEX_DEXgetinfoAll(skip, minNotaries) {
const remote = require('electron').remote;
var window = remote.getCurrentWindow();
if (!skip) {
var tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), var tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'),
ajax_data = { ajax_data = {
'userpass': tmpIguanaRPCAuth, 'userpass': tmpIguanaRPCAuth,
@ -117,9 +121,8 @@ function EDEX_DEXgetinfoAll() {
}, },
tmp_index = 0, tmp_index = 0,
get_dex_notarychains = IguanaAJAX('http://127.0.0.1:7778', ajax_data).done(function(data) { get_dex_notarychains = IguanaAJAX('http://127.0.0.1:7778', ajax_data).done(function(data) {
//console.log(get_dex_notarychains.responseText);
get_dex_notarychains = JSON.parse(get_dex_notarychains.responseText); get_dex_notarychains = JSON.parse(get_dex_notarychains.responseText);
//console.log(get_dex_notarychains) get_dex_notarychains = get_dex_notarychains.splice(0, minNotaries);
$.each(get_dex_notarychains, function( coin_index, coin_value ) { $.each(get_dex_notarychains, function( coin_index, coin_value ) {
console.log(coin_index + ': ' + coin_value); console.log(coin_index + ': ' + coin_value);
@ -129,8 +132,7 @@ function EDEX_DEXgetinfoAll() {
'agent': 'dex', 'agent': 'dex',
'method': 'getinfo', 'method': 'getinfo',
'symbol': coin_value 'symbol': coin_value
}, };
basiliskMinNotariesConnected = 10;
console.log(ajax_data); console.log(ajax_data);
@ -148,10 +150,8 @@ function EDEX_DEXgetinfoAll() {
$('#loading_sub_status_output_text').text('Output: Connected'); $('#loading_sub_status_output_text').text('Output: Connected');
} }
if ( tmp_index == 10 ) { if ( tmp_index == minNotaries ) {
console.log('min notaries connected'); console.log('min notaries connected');
const remote = require('electron').remote;
var window = remote.getCurrentWindow();
window.hide(); window.hide();
} }
}).fail(function(xhr, textStatus, error) { }).fail(function(xhr, textStatus, error) {
@ -165,4 +165,7 @@ function EDEX_DEXgetinfoAll() {
} }
}); });
}); });
} else {
window.hide();
}
} }

6
main.js

@ -9,14 +9,14 @@ 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,
fixPath = require('fix-path'); fixPath = require('fix-path');
var express = require('express'), var express = require('express'),
bodyParser = require('body-parser'), bodyParser = require('body-parser'),
fs = require('fs'), fs = require('fs'),
fsnode = require('fs'), fsnode = require('fs'),
fs = require('fs-extra'), fs = require('fs-extra'),
mkdirp = require('mkdirp'), mkdirp = require('mkdirp'),
pm2 = require('pm2'); pm2 = require('pm2');
Promise = require('bluebird'); Promise = require('bluebird');
@ -63,7 +63,7 @@ guiapp.use('/shepherd', shepherd);
var rungui = guiapp.listen(appConfig.iguanaAppPort, function () { var rungui = guiapp.listen(appConfig.iguanaAppPort, function () {
console.log('guiapp listening on port ' + appConfig.iguanaAppPort + '!'); console.log('guiapp listening on port ' + appConfig.iguanaAppPort + '!');
}) });
module.exports = guiapp; module.exports = guiapp;
// END GUI App Settings // END GUI App Settings

17
routes/shepherd.js

@ -62,6 +62,7 @@ shepherd.appConfig = {
"iguanaGuiOnly": false, "iguanaGuiOnly": false,
"manualIguanaStart": false, "manualIguanaStart": false,
"skipBasiliskNetworkCheck": false, "skipBasiliskNetworkCheck": false,
"minNotaries": 50,
"host": "127.0.0.1", "host": "127.0.0.1",
"iguanaAppPort": 17777, "iguanaAppPort": 17777,
"iguanaCorePort": 7778, "iguanaCorePort": 7778,
@ -101,7 +102,7 @@ shepherd.post('/debuglog', function(req, res) {
'msg': 'success', 'msg': 'success',
'result': result 'result': result
}; };
res.end(JSON.stringify(_obj)); res.end(JSON.stringify(_obj));
}, function(result) { }, function(result) {
var _obj = { var _obj = {
@ -109,7 +110,7 @@ shepherd.post('/debuglog', function(req, res) {
'result': result 'result': result
}; };
res.end(JSON.stringify(_obj)); res.end(JSON.stringify(_obj));
}); });
}); });
@ -126,7 +127,7 @@ shepherd.post('/herd', function(req, res) {
'msg': 'success', 'msg': 'success',
'result': 'result' 'result': 'result'
}; };
res.end(JSON.stringify(obj)); res.end(JSON.stringify(obj));
}); });
@ -149,11 +150,11 @@ shepherd.post('/herdlist', function(req, res) {
console.log(list[0].pid) // print pid of IGUANA proc console.log(list[0].pid) // print pid of IGUANA proc
var obj = { var obj = {
'herdname': req.body.herdname, 'herdname': req.body.herdname,
'status': list[0].pm2_env.status, 'status': list[0].pm2_env.status,
'pid': list[0].pid 'pid': list[0].pid
}; };
res.end(JSON.stringify(obj)); res.end(JSON.stringify(obj));
}); });
}); });
@ -170,7 +171,7 @@ shepherd.post('/slay', function(req, res) {
'msg': 'success', 'msg': 'success',
'result': 'result' 'result': 'result'
}; };
res.end(JSON.stringify(obj)); res.end(JSON.stringify(obj));
}); });
@ -185,7 +186,7 @@ shepherd.post('/setconf', function(req, res) {
'msg': 'success', 'msg': 'success',
'result': 'result' 'result': 'result'
}; };
res.end(JSON.stringify(obj)); res.end(JSON.stringify(obj));
}); });
@ -202,7 +203,7 @@ shepherd.post('/getconf', function(req, res) {
'msg': 'success', 'msg': 'success',
'result': confpath 'result': confpath
}; };
res.end(JSON.stringify(obj)); res.end(JSON.stringify(obj));
}); });

Loading…
Cancel
Save