From 10a021f5fce91016b0fe74403bbec363bafad4cf Mon Sep 17 00:00:00 2001 From: str4d Date: Mon, 6 Mar 2017 03:43:38 +0000 Subject: [PATCH] Re-layout "Banned IPs" section of /configpeer --- router/java/src/net/i2p/router/Blocklist.java | 53 +++++++++++++------ 1 file changed, 36 insertions(+), 17 deletions(-) diff --git a/router/java/src/net/i2p/router/Blocklist.java b/router/java/src/net/i2p/router/Blocklist.java index 2f7dfea27..38a5b7939 100644 --- a/router/java/src/net/i2p/router/Blocklist.java +++ b/router/java/src/net/i2p/router/Blocklist.java @@ -1017,48 +1017,58 @@ public class Blocklist { Set singles = new TreeSet(); singles.addAll(_singleIPBlocklist); if (!(singles.isEmpty() && _singleIPv6Blocklist.isEmpty())) { - out.write("
"); + out.write("
"); + out.write(""); + out.write(""); + if (!singles.isEmpty()) { + out.write(""); + } // first 0 - 127 for (Integer ii : singles) { int ip = ii.intValue(); if (ip < 0) continue; - out.write("\n"); + out.write("\n"); } // then 128 - 255 for (Integer ii : singles) { int ip = ii.intValue(); if (ip >= 0) break; - out.write("\n"); + out.write("\n"); } // then IPv6 if (!_singleIPv6Blocklist.isEmpty()) { + out.write(""); List s6; synchronized(_singleIPv6Blocklist) { s6 = new ArrayList(_singleIPv6Blocklist.keySet()); } Collections.sort(s6); for (BigInteger bi : s6) { - out.write("\n"); + out.write("\n"); } } out.write("
"); out.write(_t("IPs Banned Until Restart")); - out.write("
"); + out.write(_t("IPv4 Addresses")); + out.write("
"); + out.write("
"); out.write(toStr(ip)); - out.write(" 
"); + out.write("
"); out.write(toStr(ip)); - out.write(" 
"); + out.write(_t("IPv6 Addresses")); + out.write("
"); + out.write("
"); out.write(Addresses.toString(toIPBytes(bi))); - out.write(" 
"); } if (_blocklistSize > 0) { - out.write("
"); + out.write(""); + out.write(""); int max = Math.min(_blocklistSize, MAX_DISPLAY); @@ -1068,12 +1078,16 @@ public class Blocklist { int from = getFrom(_blocklist[i]); if (from < 0) continue; - out.write(""); int to = getTo(_blocklist[i]); if (to != from) { - out.write(toStr(to)); out.write("\n"); + out.write("\n"); } else - out.write(" \n"); + out.write("\n"); displayed++; } // then 128 - 255 @@ -1081,18 +1095,23 @@ public class Blocklist { int from = getFrom(_blocklist[i]); if (from >= 0) break; - out.write(""); int to = getTo(_blocklist[i]); if (to != from) { - out.write(toStr(to)); out.write("\n"); + out.write("\n"); } else - out.write(" \n"); + out.write("\n"); } if (_blocklistSize > MAX_DISPLAY) // very rare, don't bother translating out.write(""); out.write("
"); out.write(_t("IPs Permanently Banned")); - out.write("
"); + out.write("
"); out.write(_t("From")); - out.write(""); + out.write(""); out.write(_t("To")); out.write("
"); out.write(toStr(from)); out.write(""); + out.write("
"); + out.write(toStr(from)); + out.write("
-"); + out.write(toStr(to)); + out.write("
 
"); out.write(toStr(from)); out.write(""); + out.write("
"); + out.write(toStr(from)); + out.write("
-"); + out.write(toStr(to)); + out.write("
 
First " + MAX_DISPLAY + " displayed, see the " + BLOCKLIST_FILE_DEFAULT + " file for the full list
"); + out.write("
"); } else { out.write("
"); out.write(_t("none"));