Browse Source

Add more information to webui.

pull/271/head
EinMByte 9 years ago
parent
commit
4d6d032115
  1. 15
      webui/index.html
  2. 10
      webui/javascript/I2PControl.js

15
webui/index.html

@ -13,6 +13,12 @@ function updateRouterInfo(result, session) { @@ -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() { @@ -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);
});
};

10
webui/javascript/I2PControl.js

@ -74,6 +74,16 @@ I2PControl.statusToString = function(status) { @@ -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) {

Loading…
Cancel
Save