mirror of
https://github.com/status-im/embark-area-51.git
synced 2025-01-11 14:34:40 +00:00
Implemented logic to show version of the connected IPFS node on the dashboard
This commit is contained in:
parent
9efd107616
commit
de37c94b2e
@ -1,6 +1,6 @@
|
||||
var Web3 = require('web3');
|
||||
var async = require('async');
|
||||
|
||||
var http = require('http');
|
||||
var utils = require('./utils.js');
|
||||
|
||||
var ServicesMonitor = function(options) {
|
||||
@ -60,11 +60,35 @@ ServicesMonitor.prototype.check = function() {
|
||||
|
||||
utils.checkIsAvailable('http://localhost:5001', function(available) {
|
||||
if (available) {
|
||||
result.push('IPFS'.green);
|
||||
} else {
|
||||
result.push('IPFS'.red);
|
||||
//Ideally this method should be in an IPFS API JSONRPC wrapper
|
||||
//The URL should also be flexible to accept non-default IPFS url
|
||||
self.logger.trace("Checking IPFS version...");
|
||||
http.get('http://localhost:5001/api/v0/version', function(res) {
|
||||
var body = '';
|
||||
res.on('data', function(d) {
|
||||
body += d;
|
||||
});
|
||||
res.on('end', function() {
|
||||
var parsed = JSON.parse(body);
|
||||
if(parsed.Version){
|
||||
result.push(("IPFS " + parsed.Version).green);
|
||||
}
|
||||
else{
|
||||
result.push("IPFS".green);
|
||||
}
|
||||
callback(null, result);
|
||||
});
|
||||
res.on('error', function(err) {
|
||||
self.logger.trace("Check IPFS version error: " + err);
|
||||
result.push("IPFS".green);
|
||||
callback(null, result);
|
||||
});
|
||||
});
|
||||
}
|
||||
else {
|
||||
result.push('IPFS'.red);
|
||||
callback(null, result);
|
||||
}
|
||||
callback(null, result);
|
||||
});
|
||||
},
|
||||
function checkDevServer(result, callback) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user