diff --git a/webui/index.html b/webui/index.html index 8ddbdda3..2c8392ac 100644 --- a/webui/index.html +++ b/webui/index.html @@ -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); }); }; diff --git a/webui/javascript/I2PControl.js b/webui/javascript/I2PControl.js index 6473ad3b..120a23a5 100644 --- a/webui/javascript/I2PControl.js +++ b/webui/javascript/I2PControl.js @@ -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) {