From 606961c788f802800689e38fa883586a141e9f58 Mon Sep 17 00:00:00 2001 From: zzz <zzz@i2pmail.org> Date: Sat, 15 Jan 2022 06:59:52 -0500 Subject: [PATCH] Console: Add ban counts to headers --- .../src/net/i2p/router/web/helpers/BanlistRenderer.java | 7 ++++--- .../src/net/i2p/router/web/helpers/ConfigPeerHelper.java | 5 ++++- apps/routerconsole/jsp/configpeer.jsp | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/apps/routerconsole/java/src/net/i2p/router/web/helpers/BanlistRenderer.java b/apps/routerconsole/java/src/net/i2p/router/web/helpers/BanlistRenderer.java index 29e1c482bf..8ab9a643ee 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/helpers/BanlistRenderer.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/helpers/BanlistRenderer.java @@ -43,15 +43,16 @@ class BanlistRenderer { public void renderStatusHTML(Writer out) throws IOException { StringBuilder buf = new StringBuilder(1024); - // move to the jsp - //buf.append("<h2>Banned Peers</h2>"); Map<Hash, Banlist.Entry> entries = new TreeMap<Hash, Banlist.Entry>(new HashComparator()); entries.putAll(_context.banlist().getEntries()); + buf.append("<h3 id=\"bannedpeers\">").append(_t("Banned Peers")); if (entries.isEmpty()) { - buf.append("<i>").append(_t("none")).append("</i>"); + buf.append("</h3><i>").append(_t("none")).append("</i>"); out.write(buf.toString()); return; + } else { + buf.append(" (").append(entries.size()).append(")</h3>"); } buf.append("<ul id=\"banlist\">"); diff --git a/apps/routerconsole/java/src/net/i2p/router/web/helpers/ConfigPeerHelper.java b/apps/routerconsole/java/src/net/i2p/router/web/helpers/ConfigPeerHelper.java index 67815308de..e18819d534 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/helpers/ConfigPeerHelper.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/helpers/ConfigPeerHelper.java @@ -21,9 +21,12 @@ public class ConfigPeerHelper extends HelperBase { out.write("<table id=\"bannedips\"><tr><td>" + "<table id=\"banneduntilrestart\"><tr><th align=\"center\"><b>"); out.write(_t("IPs Banned Until Restart")); - out.write("</b></th></tr>"); List<Integer> singles = bl.getTransientIPv4Blocks(); List<BigInteger> s6 = bl.getTransientIPv6Blocks(); + int sz = singles.size() + s6.size(); + if (sz > 0) + out.write(" (" + sz + ')'); + out.write("</b></th></tr>"); if (!(singles.isEmpty() && s6.isEmpty())) { if (!singles.isEmpty()) { Collections.sort(singles); diff --git a/apps/routerconsole/jsp/configpeer.jsp b/apps/routerconsole/jsp/configpeer.jsp index a65d5b0696..2ff2a2d410 100644 --- a/apps/routerconsole/jsp/configpeer.jsp +++ b/apps/routerconsole/jsp/configpeer.jsp @@ -82,7 +82,7 @@ </tr> </table> </form> - <a name="banlist"> </a><h3 id="bannedpeers"><%=intl._t("Banned Peers")%></h3> +<%-- h3 in BanlistRenderer --%> <jsp:useBean class="net.i2p.router.web.helpers.ProfilesHelper" id="profilesHelper" scope="request" /> <jsp:setProperty name="profilesHelper" property="contextId" value="<%=i2pcontextId%>" /> <% profilesHelper.storeWriter(out); %> -- GitLab