From caf18f819deac7587e9164b74ec719ae41de68c3 Mon Sep 17 00:00:00 2001 From: dr|z3d Date: Thu, 26 Aug 2021 06:43:47 +0000 Subject: [PATCH] Console: migrate transit traffic / bandwidth to same rows as standard b/w --- daemon/HTTPServer.cpp | 42 +++++++++++++++++++++++++++++++++++------- webconsole/style.css | 5 +++++ 2 files changed, 40 insertions(+), 7 deletions(-) diff --git a/daemon/HTTPServer.cpp b/daemon/HTTPServer.cpp index 65add91a..621a5673 100644 --- a/daemon/HTTPServer.cpp +++ b/daemon/HTTPServer.cpp @@ -610,7 +610,6 @@ namespace http { #endif s << "" << tr("Bandwidth") << ""; s << std::fixed << std::setprecision(0); -// s << (double) i2p::transport::transports.GetInBandwidth () / 1024 << " " << tr(/* tr: Kibibit/s */ "KiB/s"); if (i2p::transport::transports.GetInBandwidth () > 1024*1024*1024 || i2p::transport::transports.GetInBandwidth () < 1024) s << std::fixed << std::setprecision(2); @@ -618,7 +617,6 @@ namespace http { s << std::fixed << std::setprecision(1); s << (double) i2p::transport::transports.GetInBandwidth () / 1024 << " " << tr(/* tr: Kibibit/s */ "K/s"); s << " / "; -// s << (double) i2p::transport::transports.GetOutBandwidth () / 1024 << " " << tr(/* tr: Kibibit/s */ "KiB/s"); s << std::fixed << std::setprecision(0); if (i2p::transport::transports.GetOutBandwidth () > 1024*1024*1024 || i2p::transport::transports.GetOutBandwidth () < 1024) @@ -626,7 +624,20 @@ namespace http { else if (i2p::transport::transports.GetOutBandwidth () > 1024*1024) s << std::fixed << std::setprecision(1); s << (double) i2p::transport::transports.GetOutBandwidth () / 1024 << " " << tr(/* tr: Kibibit/s */ "K/s"); - s << "\r\n"; + s << ""; + + if (i2p::context.AcceptsTunnels () && i2p::tunnel::tunnels.CountTransitTunnels()) { + if (i2p::transport::transports.GetTransitBandwidth () > 1024*1024*1024 || + i2p::transport::transports.GetTransitBandwidth () < 1024) + s << std::fixed << std::setprecision(2); + else if (i2p::transport::transports.GetTransitBandwidth () > 1024*1024) + s << std::fixed << std::setprecision(1); + s << " / "; + s << (double) i2p::transport::transports.GetTransitBandwidth () / 1024; + s << " " << tr(/* tr: Kibibit/s */ "K/s") << ""; + } + + s << "\r\n"; s << "" << tr("Transferred") << ""; s << std::fixed << std::setprecision(0); if (i2p::transport::transports.GetTotalReceivedBytes () > 1024*1024*1024) @@ -641,7 +652,23 @@ namespace http { else if (i2p::transport::transports.GetTotalSentBytes () > 1024*1024) s << std::fixed << std::setprecision(1); ShowTraffic (s, i2p::transport::transports.GetTotalSentBytes ()); - s << "\r\n"; + s << ""; + + if (i2p::context.AcceptsTunnels () && i2p::tunnel::tunnels.CountTransitTunnels()) { + s << " / "; + s << std::fixed << std::setprecision(0); + if (i2p::transport::transports.GetTotalTransitTransmittedBytes () > 1024*1024*1024) + s << std::fixed << std::setprecision(2); + else if (i2p::transport::transports.GetTotalTransitTransmittedBytes () > 1024*1024) + s << std::fixed << std::setprecision(1); + ShowTraffic (s, i2p::transport::transports.GetTotalTransitTransmittedBytes ()); + s << std::fixed << std::setprecision(0); + s << ""; + } + + s << "\r\n"; + +/* if (i2p::context.AcceptsTunnels () && i2p::tunnel::tunnels.CountTransitTunnels()) { s << "" << tr("Transit") << ""; s << std::fixed << std::setprecision(0); @@ -657,9 +684,10 @@ namespace http { else if (i2p::transport::transports.GetTransitBandwidth () > 1024*1024) s << std::fixed << std::setprecision(1); s << " (" << (double) i2p::transport::transports.GetTransitBandwidth () / 1024; -// s << " " << tr(/* tr: Kibibit/s */ "KiB/s") << ")\r\n"; - s << " " << tr(/* tr: Kibibit/s */ "K/s") << ")\r\n"; + s << " " << tr("K/s") << ")\r\n"; } +*/ + s << "" << tr("Build Success") << ""; s << i2p::tunnel::tunnels.GetTunnelCreationSuccessRate () << "%\r\n"; s << "" << tr("Routers") << "" << i2p::data::netdb.GetNumRouters () << "\r\n"; @@ -1355,7 +1383,7 @@ namespace http { s << "" << tr("Transit Tunnels") << ""; s << "\r\n"; s << "
8) + if (count > 7) s << "id=\"transit\" "; s << "class=\"list\">\r\n"; for (const auto& it: i2p::tunnel::tunnels.GetTransitTunnels ()) diff --git a/webconsole/style.css b/webconsole/style.css index 829e6418..01cf27d4 100644 --- a/webconsole/style.css +++ b/webconsole/style.css @@ -16,6 +16,7 @@ --arrow_left: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23dbd' viewBox='0 0 64 64'%3E%3Cpath d='M4.5 32l30-30v20.2h25v19.6h-25V62z'/%3E%3C/svg%3E"); --arrow_right: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23dbd' viewBox='0 0 64 64'%3E%3Cpath d='M59.5 32l-30-30v20.2h-25v19.6h25V62z'/%3E%3C/svg%3E"); --arrow_up: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23dbd' viewBox='0 0 64 64'%3E%3Cpath d='M32 4.5l-30 30h20.2v25h19.6v-25H62z'/%3E%3C/svg%3E"); + --arrow_up_transit: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%237f7' viewBox='0 0 64 64'%3E%3Cpath d='M32 4.5l-30 30h20.2v25h19.6v-25H62z'/%3E%3C/svg%3E"); --arrow_down: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23dbd' viewBox='0 0 64 64'%3E%3Cpath d='M32 59.5l-30-30h20.2v-25h19.6v25H62z'/%3E%3C/svg%3E"); --arrow_double: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23dbd' viewBox='0 0 64 64'%3E%3Cpath d='M2.4 32l20.9-20.9v14h6.3v13.7h-6.3v14zM61.6 32L40.7 11.1v14h-6.3v13.7h6.3v14z'/%3E%3C/svg%3E"); --error: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cg stroke-linejoin='round'%3E%3Cpath fill='none' stroke='%23300' stroke-width='10' d='M58 54.6H6l26-45z'/%3E%3Cpath fill='%23fff' stroke='%23b00' stroke-width='3' d='M58 54.6H6l26-45z'/%3E%3C/g%3E%3Cpath d='M29.5 24.5h5v14.7h-5zm0 18.6h5v5.6h-5z'/%3E%3C/svg%3E"); @@ -995,6 +996,10 @@ a:hover .host, a:focus .host, a:active .host { background: var(--arrow_up) no-repeat right center / 12px; } +.transit.sent { + background: var(--arrow_up_transit) no-repeat right center / 12px; +} + .recvd { background: var(--arrow_down) no-repeat right center / 12px; }