Add more information to webui.

This commit is contained in:
EinMByte 2015-09-07 13:41:48 +02:00
parent 719bfbc89b
commit 4d6d032115
2 changed files with 24 additions and 1 deletions

View File

@ -13,6 +13,12 @@ function updateRouterInfo(result, session) {
I2PControl.updateDocument({
"version" : result["i2p.router.version"],
"status" : I2PControl.statusToString(result["i2p.router.net.status"]),
"uptime" : I2PControl.msToString(result["i2p.router.uptime"]),
"knownpeers" : result["i2p.router.netdb.knownpeers"],
"activepeers" : result["i2p.router.netdb.activepeers"],
"tunnels-participating" : result["i2p.router.net.tunnels.participating"],
"bw-in" : result["i2p.router.net.bw.inbound.1s"],
"bw-out" : result["i2p.router.net.bw.outbound.1s"]
});
}
@ -20,7 +26,14 @@ window.onload = function() {
var session = new I2PControl.Session("itoopie");
session.start(function() {
session.request("RouterInfo", {
"i2p.router.version" : "", "i2p.router.net.status" : ""
"i2p.router.version" : "",
"i2p.router.net.status" : "",
"i2p.router.uptime" : "",
"i2p.router.netdb.knownpeers" : "",
"i2p.router.netdb.activepeers" : "",
"i2p.router.net.tunnels.participating" : "",
"i2p.router.net.bw.inbound.1s" : "",
"i2p.router.net.bw.outbound.1s" : ""
}, updateRouterInfo);
});
};

View File

@ -74,6 +74,16 @@ I2PControl.statusToString = function(status) {
}
};
I2PControl.msToString = function(mseconds) {
var seconds = mseconds / 1000;
var numdays = Math.floor(seconds / 86400);
var numhours = Math.floor((seconds % 86400) / 3600);
var numminutes = Math.floor(((seconds % 86400) % 3600) / 60);
var numseconds = ((seconds % 86400) % 3600) % 60;
return numdays + "d " + numhours + "h " + numminutes + "m " + numseconds + "s";
}
I2PControl.updateDocument = function(values) {
for(id in values) {