Console: Add ban counts to headers

This commit is contained in:
zzz
2022-01-15 06:59:52 -05:00
parent 70bb63e8ab
commit 606961c788
3 changed files with 9 additions and 5 deletions

View File

@ -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\">");

View File

@ -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);

View File

@ -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); %>