Add a bunch of ids and classes to routerconsole HTML for styling

This commit is contained in:
str4d
2016-04-18 04:12:15 +00:00
parent da62a1114c
commit ac6cd7e4c6
51 changed files with 192 additions and 183 deletions

View File

@ -50,7 +50,7 @@ class BanlistRenderer {
return;
}
buf.append("<ul>");
buf.append("<ul id=\"banlist\">");
for (Map.Entry<Hash, Banlist.Entry> e : entries.entrySet()) {
Hash key = e.getKey();

View File

@ -112,7 +112,7 @@ public class ConfigClientsHelper extends HelperBase {
/** clients */
public String getForm1() {
StringBuilder buf = new StringBuilder(1024);
buf.append("<table>\n" +
buf.append("<table id=\"clientconfig\">\n" +
"<tr><th align=\"right\">").append(_t("Client")).append("</th><th>")
.append(_t("Run at Startup?")).append("</th><th>")
.append(_t("Control")).append("</th><th align=\"left\">")
@ -198,7 +198,7 @@ public class ConfigClientsHelper extends HelperBase {
/** webapps */
public String getForm2() {
StringBuilder buf = new StringBuilder(1024);
buf.append("<table>\n" +
buf.append("<table id=\"webappconfig\">\n" +
"<tr><th align=\"right\">").append(_t("WebApp")).append("</th><th>")
.append(_t("Run at Startup?")).append("</th><th>")
.append(_t("Control")).append("</th><th align=\"left\">")
@ -227,7 +227,7 @@ public class ConfigClientsHelper extends HelperBase {
/** plugins */
public String getForm3() {
StringBuilder buf = new StringBuilder(1024);
buf.append("<table>\n" +
buf.append("<table id=\"pluginconfig\">\n" +
"<tr><th align=\"right\">").append(_t("Plugin")).append("</th><th>")
.append(_t("Run at Startup?")).append("</th><th>")
.append(_t("Control")).append("</th><th align=\"left\">")

View File

@ -26,7 +26,7 @@ public class ConfigTunnelsHelper extends HelperBase {
cur++;
}
buf.append("<table>\n");
buf.append("<table id=\"tunnelconfig\">\n");
TunnelPoolSettings exploratoryIn = _context.tunnelManager().getInboundSettings();
TunnelPoolSettings exploratoryOut = _context.tunnelManager().getOutboundSettings();
@ -69,7 +69,7 @@ public class ConfigTunnelsHelper extends HelperBase {
boolean advanced = isAdvanced();
buf.append("<tr><th colspan=\"3\"><a name=\"").append(prefix).append("\">");
buf.append("<tr><th colspan=\"3\" class=\"th_title\"><a name=\"").append(prefix).append("\">");
buf.append(name).append("</a></th></tr>\n");
if (in.getLength() <= 0 ||
in.getLength() + in.getLengthVariance() <= 0 ||

View File

@ -9,6 +9,7 @@ public class ConfigUIHelper extends HelperBase {
public String getSettings() {
StringBuilder buf = new StringBuilder(512);
buf.append("<div id=\"availablethemes\">");
String current = _context.getProperty(CSSHelper.PROP_THEME_NAME, CSSHelper.DEFAULT_THEME);
Set<String> themes = themeSet();
for (String theme : themes) {
@ -18,6 +19,7 @@ public class ConfigUIHelper extends HelperBase {
buf.append("value=\"").append(theme).append("\">").append(_t(theme)).append("<br>\n");
}
boolean universalTheming = _context.getBooleanProperty(CSSHelper.PROP_UNIVERSAL_THEMING);
buf.append("</div><div id=\"themeoptions\">");
buf.append("<input type=\"checkbox\" name=\"universalTheming\" ");
if (universalTheming)
buf.append(CHECKED);
@ -35,7 +37,7 @@ public class ConfigUIHelper extends HelperBase {
buf.append(CHECKED);
buf.append("value=\"1\">")
.append(_t("Force the mobile console to be used"))
.append("<br>\n");
.append("</div>\n");
return buf.toString();
}
@ -164,7 +166,7 @@ public class ConfigUIHelper extends HelperBase {
StringBuilder buf = new StringBuilder(512);
ConsolePasswordManager mgr = new ConsolePasswordManager(_context);
Map<String, String> userpw = mgr.getMD5(RouterConsoleRunner.PROP_CONSOLE_PW);
buf.append("<table>");
buf.append("<table id=\"consolepass\">");
if (userpw.isEmpty()) {
buf.append("<tr><td colspan=\"3\">");
buf.append(_t("Add a user and password to enable."));

View File

@ -99,7 +99,7 @@ public class EventLogHelper extends FormHandler {
// So just use the "shared/console nonce".
String nonce = CSSHelper.getNonce();
try {
_out.write("<br><h3>" + _t("Display Events") + "</h3>");
_out.write("<br><h3 id=\"displayevents\">" + _t("Display Events") + "</h3>");
_out.write("<form action=\"events\" method=\"POST\">\n" +
"<input type=\"hidden\" name=\"action\" value=\"save\">\n" +
"<input type=\"hidden\" name=\"nonce\" value=\"" + nonce + "\" >\n");
@ -175,7 +175,7 @@ public class EventLogHelper extends FormHandler {
return _t("No \"{0}\" events found in previous {1}", xev, DataHelper.formatDuration2(_age));
}
StringBuilder buf = new StringBuilder(2048);
buf.append("<table><tr><th>");
buf.append("<table id=\"eventlog\"><tr><th>");
buf.append(_t("Time"));
buf.append("</th><th>");
if (isAll) {

View File

@ -29,7 +29,7 @@ public class FileDumpHelper extends HelperBase {
public String getFileSummary() {
StringBuilder buf = new StringBuilder(16*1024);
buf.append("<table><tr><th>File</th><th>Size</th><th>Date</th><th>SHA 256</th><th>Revision</th>" +
buf.append("<table id=\"jardump\"><tr><th>File</th><th>Size</th><th>Date</th><th>SHA 256</th><th>Revision</th>" +
"<th>JDK</th><th>Built</th><th>By</th><th>Mods</th></tr>");
// jars added in wrapper.config

View File

@ -232,12 +232,12 @@ public class GraphHelper extends FormHandler {
name = r.getRateStat().getName();
displayName = name;
}
_out.write("<h3>");
_out.write("<h3 id=\"graphinfo\">");
_out.write(_t("{0} for {1}", displayName, DataHelper.formatDuration2(_periodCount * period)));
if (_end > 0)
_out.write(' ' + _t("ending {0} ago", DataHelper.formatDuration2(_end * period)));
_out.write("</h3><img class=\"statimage\" border=\"0\""
_out.write("</h3><div class=\"graphspanel\"><img class=\"statimage\" border=\"0\""
+ " src=\"viewstat.jsp?stat="
+ name
+ "&amp;showEvents=" + _showEvents
@ -246,7 +246,7 @@ public class GraphHelper extends FormHandler {
+ "&amp;end=" + _end
+ "&amp;width=" + _width
+ "&amp;height=" + _height
+ "\"><p>\n");
+ "\"></div><p id=\"graphopts\">\n");
if (_width < MAX_X && _height < MAX_Y) {
_out.write(link(_stat, _showEvents, _periodCount, _end, _width * 3 / 2, _height * 3 / 2));
@ -353,7 +353,7 @@ public class GraphHelper extends FormHandler {
// So just use the "shared/console nonce".
String nonce = CSSHelper.getNonce();
try {
_out.write("<br><h3>" + _t("Configure Graph Display") + " [<a href=\"configstats\">" + _t("Select Stats") + "</a>]</h3>");
_out.write("<br><h3 id=\"graphdisplay\">" + _t("Configure Graph Display") + " [<a href=\"configstats\">" + _t("Select Stats") + "</a>]</h3>");
_out.write("<form action=\"graphs\" method=\"POST\">\n" +
"<input type=\"hidden\" name=\"action\" value=\"save\">\n" +
"<input type=\"hidden\" name=\"nonce\" value=\"" + nonce + "\" >\n");
@ -384,7 +384,7 @@ public class GraphHelper extends FormHandler {
if (persistent)
_out.write(HelperBase.CHECKED);
_out.write(">" +
"<hr><div class=\"formaction\"><input type=\"submit\" class=\"accept\" value=\"" + _t("Save settings and redraw graphs") + "\"></div></form>");
"<hr><div class=\"formaction\" id=\"graphing\"><input type=\"submit\" class=\"accept\" value=\"" + _t("Save settings and redraw graphs") + "\"></div></form>");
} catch (IOException ioe) {
ioe.printStackTrace();
}

View File

@ -211,7 +211,7 @@ public class HomeHelper extends HelperBase {
private String renderConfig(Collection<App> apps) {
StringBuilder buf = new StringBuilder(1024);
buf.append("<table><tr><th>")
buf.append("<table class=\"homelinkedit\"><tr><th>")
.append(_t("Remove"))
.append("</th><th colspan=\"2\">")
.append(_t("Name"))
@ -238,7 +238,7 @@ public class HomeHelper extends HelperBase {
buf.append(url);
buf.append("</a></td></tr>\n");
}
buf.append("<tr><td colspan=\"2\" align=\"center\"><b>")
buf.append("<tr id=\"addnew\"><td colspan=\"2\" align=\"center\"><b>")
.append(_t("Add")).append(":</b>" +
"</td><td align=\"left\"><input type=\"text\" name=\"nofilter_name\"></td>" +
"<td align=\"left\"><input type=\"text\" size=\"40\" name=\"nofilter_url\"></td></tr>");

View File

@ -120,7 +120,7 @@ public class JobQueueHelper extends HelperBase {
List<String> names = new ArrayList<String>(counter.objects());
if (names.size() < 4)
return;
buf.append("<table style=\"width: 30%; margin-left: 100px;\">\n" +
buf.append("<table id=\"schedjobs\" style=\"width: 30%; margin-left: 100px;\">\n" +
"<tr><th>").append(_t("Job")).append("</th><th>").append(_t("Queued")).append("<th>");
Collections.sort(names, new JobCountComparator(counter));
for (String name : names) {
@ -137,7 +137,7 @@ public class JobQueueHelper extends HelperBase {
* @since 0.8.9
*/
private void getJobStats(StringBuilder buf) {
buf.append("<table>\n" +
buf.append("<table id=\"jobstats\">\n" +
"<tr><th>").append(_t("Job")).append("</th><th>").append(_t("Runs")).append("</th>" +
"<th>").append(_t("Dropped")).append("</th>" +
"<th>").append(_t("Time")).append("</th><th><i>").append(_t("Avg")).append("</i></th><th><i>")

View File

@ -124,7 +124,7 @@ class NetDbRenderer {
public void renderLeaseSetHTML(Writer out, boolean debug) throws IOException {
StringBuilder buf = new StringBuilder(4*1024);
if (debug)
buf.append("<p>Debug mode - Sorted by hash distance, closest first</p>\n");
buf.append("<p id=\"debugmode\">Debug mode - Sorted by hash distance, closest first</p>\n");
Hash ourRKey;
Set<LeaseSet> leases;
DecimalFormat fmt;
@ -338,14 +338,14 @@ class NetDbRenderer {
if (!showStats) {
// the summary table
buf.append("<table border=\"0\" cellspacing=\"30\"><tr><th colspan=\"3\">")
buf.append("<table id=\"netdboverview\" border=\"0\" cellspacing=\"30\"><tr><th colspan=\"3\">")
.append(_t("Network Database Router Statistics"))
.append("</th></tr><tr><td style=\"vertical-align: top;\">");
// versions table
List<String> versionList = new ArrayList<String>(versions.objects());
if (!versionList.isEmpty()) {
Collections.sort(versionList, Collections.reverseOrder(new VersionComparator()));
buf.append("<table>\n");
buf.append("<table id=\"netdbversions\">\n");
buf.append("<tr><th>" + _t("Version") + "</th><th>" + _t("Count") + "</th></tr>\n");
for (String routerVersion : versionList) {
int num = versions.count(routerVersion);
@ -364,7 +364,7 @@ class NetDbRenderer {
start = end;
// transports table
buf.append("<table>\n");
buf.append("<table id=\"netdbtransports\">\n");
buf.append("<tr><th align=\"left\">" + _t("Transports") + "</th><th>" + _t("Count") + "</th></tr>\n");
for (int i = 0; i < TNAMES.length; i++) {
int num = transportCount[i];
@ -386,7 +386,7 @@ class NetDbRenderer {
List<String> countryList = new ArrayList<String>(countries.objects());
if (!countryList.isEmpty()) {
Collections.sort(countryList, new CountryComparator());
buf.append("<table>\n");
buf.append("<table id=\"netdbcountrylist\">\n");
buf.append("<tr><th align=\"left\">" + _t("Country") + "</th><th>" + _t("Count") + "</th></tr>\n");
for (String country : countryList) {
int num = countries.count(country);

View File

@ -78,13 +78,14 @@ class ProfileOrganizerRenderer {
if (mode < 2) {
//buf.append("<h2>").append(_t("Peer Profiles")).append("</h2>\n<p>");
buf.append("<p id=\"profiles_overview\" class=\"infohelp\">");
buf.append(ngettext("Showing 1 recent profile.", "Showing {0} recent profiles.", order.size())).append('\n');
if (older > 0)
buf.append(ngettext("Hiding 1 older profile.", "Hiding {0} older profiles.", older)).append('\n');
if (standard > 0)
buf.append("<a href=\"/profiles?f=1\">").append(ngettext("Hiding 1 standard profile.", "Hiding {0} standard profiles.", standard)).append("</a>\n");
buf.append("</p>");
buf.append("<table>");
buf.append("<table id=\"profiles\">");
buf.append("<tr>");
buf.append("<th>").append(_t("Peer")).append("</th>");
buf.append("<th>").append(_t("Groups (Caps)")).append("</th>");
@ -197,7 +198,7 @@ class ProfileOrganizerRenderer {
//buf.append("<h2><a name=\"flood\"></a>").append(_t("Floodfill and Integrated Peers"))
// .append(" (").append(integratedPeers.size()).append(")</h2>\n");
buf.append("<table>");
buf.append("<div class=\"widescroll\"><table id=\"floodfills\">");
buf.append("<tr>");
buf.append("<th class=\"smallhead\">").append(_t("Peer")).append("</th>");
buf.append("<th class=\"smallhead\">").append(_t("Caps")).append("</th>");
@ -250,7 +251,7 @@ class ProfileOrganizerRenderer {
}
buf.append("</tr>\n");
}
buf.append("</table>");
buf.append("</table></div>");
////
//// don't bother reindenting

View File

@ -69,12 +69,12 @@ public class StatsGenerator {
for (Map.Entry<String, Set<String>> entry : groups.entrySet()) {
String group = entry.getKey();
Set<String> stats = entry.getValue();
buf.append("<h3><a name=\"");
buf.append("<h3 class=\"stats\"><a name=\"");
buf.append(group);
buf.append("\">");
buf.append(_t(group));
buf.append("</a></h3>");
buf.append("<ul>");
buf.append("<ul class=\"statlist\">");
out.write(buf.toString());
buf.setLength(0);
for (String stat : stats) {

View File

@ -139,7 +139,7 @@ class SummaryBarRenderer {
.append(_t("I2P Services"))
.append("</a></h3>\n" +
"<hr class=\"b\"><table><tr><td>" +
"<hr class=\"b\"><table id=\"services\"><tr><td>" +
"<a href=\"/susimail/susimail\" target=\"_blank\" title=\"")
.append(_t("Anonymous webmail client"))
@ -456,7 +456,7 @@ class SummaryBarRenderer {
.append("\" target=\"_top\">")
.append(_t("Bandwidth in/out"))
.append("</a></h3><hr class=\"b\">" +
"<table>\n" +
"<table id=\"bandwidth\">\n" +
"<tr><td align=\"left\"><b>")
.append(DataHelper.formatDuration2(3 * 1000)) // lie and say 3 sec since 1 sec would appear as 1000 ms

View File

@ -928,7 +928,7 @@ public class SummaryHelper extends HelperBase {
String imgPath = CSSHelper.BASE_THEME_PATH + theme + "/images/";
StringBuilder buf = new StringBuilder(2048);
buf.append("<table class=\"sidebarconf\"><tr><th>")
buf.append("<table id=\"sidebarconf\"><tr><th>")
.append(_t("Remove"))
.append("</th><th>")
.append(_t("Name"))

View File

@ -154,15 +154,15 @@ class SybilRenderer {
ris.add(ri);
}
if (ris.isEmpty()) {
out.write("<h3>No known floodfills</h3>");
out.write("<h3 class=\"sybils\">No known floodfills</h3>");
return;
}
StringBuilder buf = new StringBuilder(4*1024);
buf.append("<p><b>This is an experimental network database tool for debugging and analysis. Do not panic even if you see warnings below. " +
buf.append("<p id=\"sybilinfo\"><b>This is an experimental network database tool for debugging and analysis. Do not panic even if you see warnings below. " +
"Possible \"threats\" are summarized at the bottom, however these are unlikely to be real threats. " +
"If you see anything you would like to discuss with the devs, contact us on IRC #i2p-dev.</b></p>" +
"<ul><li><a href=\"#known\">FF Summary</a>" +
"<div id=\"sybilnav\"><ul><li><a href=\"#known\">FF Summary</a>" +
"</li><li><a href=\"#family\">Same Family</a>" +
"</li><li><a href=\"#ourIP\">IP close to us</a>" +
"</li><li><a href=\"#sameIP\">Same IP</a>" +
@ -174,10 +174,10 @@ class SybilRenderer {
"</li><li><a href=\"#dht\">DHT neighbors</a>" +
"</li><li><a href=\"#dest\">Close to our destinations</a>" +
"</li><li><a href=\"#threats\">Highest threats</a>" +
"</li></ul>");
"</li></ul></div>");
renderRouterInfo(buf, _context.router().getRouterInfo(), null, true, false);
buf.append("<h3 id=\"known\">Known Floodfills: ").append(ris.size()).append("</h3>");
buf.append("<h3 id=\"known\" class=\"sybils\">Known Floodfills: ").append(ris.size()).append("</h3>");
double tot = 0;
int count = 200;
@ -209,18 +209,18 @@ class SybilRenderer {
renderPairDistance(out, buf, ris, points);
// Distance to our router analysis
buf.append("<h3 id=\"ritoday\">Closest Floodfills to Our Routing Key (Where we Store our RI)</h3>");
buf.append("<h3 id=\"ritoday\" class=\"sybils\">Closest Floodfills to Our Routing Key (Where we Store our RI)</h3>");
renderRouterInfoHTML(out, buf, ourRKey, avgMinDist, ris, points);
RouterKeyGenerator rkgen = _context.routerKeyGenerator();
Hash nkey = rkgen.getNextRoutingKey(us);
buf.append("<h3 id=\"ritmrw\">Closest Floodfills to Tomorrow's Routing Key (Where we will Store our RI)</h3>");
buf.append("<h3 id=\"ritmrw\" class=\"sybils\">Closest Floodfills to Tomorrow's Routing Key (Where we will Store our RI)</h3>");
renderRouterInfoHTML(out, buf, nkey, avgMinDist, ris, points);
buf.append("<h3 id=\"dht\">Closest Floodfills to Our Router Hash (DHT Neighbors if we are Floodfill)</h3>");
buf.append("<h3 id=\"dht\" class=\"sybils\">Closest Floodfills to Our Router Hash (DHT Neighbors if we are Floodfill)</h3>");
renderRouterInfoHTML(out, buf, us, avgMinDist, ris, points);
// Distance to our published destinations analysis
buf.append("<h3 id=\"dest\">Floodfills Close to Our Destinations</h3>");
buf.append("<h3 id=\"dest\" class=\"sybils\">Floodfills Close to Our Destinations</h3>");
Map<Hash, TunnelPool> clientInboundPools = _context.tunnelManager().getInboundClientPools();
List<Hash> destinations = new ArrayList<Hash>(clientInboundPools.keySet());
boolean debug = _context.getBooleanProperty(HelperBase.PROP_ADVANCED);
@ -236,10 +236,10 @@ class SybilRenderer {
Hash rkey = ls.getRoutingKey();
TunnelPool in = clientInboundPools.get(client);
String name = (in != null) ? in.getSettings().getDestinationNickname() : client.toBase64().substring(0,4);
buf.append("<h3>Closest floodfills to the Routing Key for " + DataHelper.escapeHTML(name) + " (where we store our LS)</h3>");
buf.append("<h3 class=\"sybils\">Closest floodfills to the Routing Key for " + DataHelper.escapeHTML(name) + " (where we store our LS)</h3>");
renderRouterInfoHTML(out, buf, rkey, avgMinDist, ris, points);
nkey = rkgen.getNextRoutingKey(ls.getHash());
buf.append("<h3>Closest floodfills to Tomorrow's Routing Key for " + DataHelper.escapeHTML(name) + " (where we will store our LS)</h3>");
buf.append("<h3 class=\"sybils\">Closest floodfills to Tomorrow's Routing Key for " + DataHelper.escapeHTML(name) + " (where we will store our LS)</h3>");
renderRouterInfoHTML(out, buf, nkey, avgMinDist, ris, points);
}
@ -250,7 +250,7 @@ class SybilRenderer {
if (!points.isEmpty()) {
List<Hash> warns = new ArrayList<Hash>(points.keySet());
Collections.sort(warns, new PointsComparator(points));
buf.append("<h3 id=\"threats\">Routers with Most Threat Points</h3>");
buf.append("<h3 id=\"threats\" class=\"sybils\">Routers with Most Threat Points</h3>");
for (Hash h : warns) {
RouterInfo ri = _context.netDb().lookupRouterInfoLocally(h);
if (ri == null)
@ -259,7 +259,7 @@ class SybilRenderer {
double p = pp.points;
if (p < MIN_DISPLAY_POINTS)
break; // sorted
buf.append("<p><b>Threat Points: " + fmt.format(p) + "</b><ul>");
buf.append("<p class=\"threatpoints\"><b>Threat Points: " + fmt.format(p) + "</b><ul>");
for (String s : pp.reasons) {
buf.append("<li>").append(s).append("</li>");
}
@ -307,9 +307,9 @@ class SybilRenderer {
}
double avg = total / (sz * sz / 2);
buf.append("<h3>Average Floodfill Distance is ").append(fmt.format(avg)).append("</h3>");
buf.append("<h3 class=\"sybils\">Average Floodfill Distance is ").append(fmt.format(avg)).append("</h3>");
buf.append("<h3 id=\"pairs\">Closest Floodfill Pairs by Hash</h3>");
buf.append("<h3 id=\"pairs\" class=\"sybils\">Closest Floodfill Pairs by Hash</h3>");
for (Pair p : pairs) {
double distance = biLog2(p.dist);
double point = MIN_CLOSE - distance;
@ -317,7 +317,7 @@ class SybilRenderer {
break; // sorted;
if (point >= 2) {
// limit display
buf.append("<p><b>Hash Distance: ").append(fmt.format(distance)).append(": </b>");
buf.append("<p class=\"hashdist\"><b>Hash Distance: ").append(fmt.format(distance)).append(": </b>");
buf.append("</p>");
renderRouterInfo(buf, p.r1, null, false, false);
renderRouterInfo(buf, p.r2, null, false, false);
@ -386,14 +386,14 @@ class SybilRenderer {
byte[] ourIP = getIP(us);
if (ourIP == null)
return;
buf.append("<h3 \"ourIP\">Floodfills close to Our IP</h3>");
buf.append("<h3 id=\"ourIP\" class=\"sybils\">Floodfills close to Our IP</h3>");
boolean found = false;
for (RouterInfo info : ris) {
byte[] ip = getIP(info);
if (ip == null)
continue;
if (ip[0] == ourIP[0] && ip[1] == ourIP[1]) {
buf.append("<p><b>");
buf.append("<p id=\"sybil_floodfill\"><b>");
if (ip[2] == ourIP[2]) {
if (ip[3] == ourIP[3]) {
buf.append("Same IP as us");
@ -412,14 +412,14 @@ class SybilRenderer {
}
}
if (!found)
buf.append("<p>None</p>");
buf.append("<p class=\"notfound\">None</p>");
out.write(buf.toString());
out.flush();
buf.setLength(0);
}
private void renderIPGroups32(Writer out, StringBuilder buf, List<RouterInfo> ris, Map<Hash, Points> points) throws IOException {
buf.append("<h3 id=\"sameIP\">Floodfills with the Same IP</h3>");
buf.append("<h3 id=\"sameIP\" class=\"sybils\">Floodfills with the Same IP</h3>");
ObjectCounter<Integer> oc = new ObjectCounter<Integer>();
for (RouterInfo info : ris) {
byte[] ip = getIP(info);
@ -443,7 +443,7 @@ class SybilRenderer {
int i1 = (i >> 16) & 0xff;
int i2 = (i >> 8) & 0xff;
int i3 = i & 0xff;
buf.append("<p><b>").append(count).append(" floodfills with IP ").append(i0).append('.')
buf.append("<p class=\"sybil_floodfill\"><b>").append(count).append(" floodfills with IP ").append(i0).append('.')
.append(i1).append('.').append(i2).append('.').append(i3)
.append(":</b></p>");
for (RouterInfo info : ris) {
@ -465,14 +465,14 @@ class SybilRenderer {
}
}
if (!found)
buf.append("<p>None</p>");
buf.append("<p class=\"notfound\">None</p>");
out.write(buf.toString());
out.flush();
buf.setLength(0);
}
private void renderIPGroups24(Writer out, StringBuilder buf, List<RouterInfo> ris, Map<Hash, Points> points) throws IOException {
buf.append("<h3 id=\"same24\">Floodfills in the Same /24 (2 minimum)</h3>");
buf.append("<h3 id=\"same24\" class=\"sybils\">Floodfills in the Same /24 (2 minimum)</h3>");
ObjectCounter<Integer> oc = new ObjectCounter<Integer>();
for (RouterInfo info : ris) {
byte[] ip = getIP(info);
@ -495,7 +495,7 @@ class SybilRenderer {
int i0 = i >> 16;
int i1 = (i >> 8) & 0xff;
int i2 = i & 0xff;
buf.append("<p><b>").append(count).append(" floodfills in ").append(i0).append('.')
buf.append("<p class=\"sybil_floodfill\"><b>").append(count).append(" floodfills in ").append(i0).append('.')
.append(i1).append('.').append(i2).append(".0/24:</b></p>");
for (RouterInfo info : ris) {
byte[] ip = getIP(info);
@ -514,14 +514,14 @@ class SybilRenderer {
}
}
if (!found)
buf.append("<p>None</p>");
buf.append("<p class=\"notfound\">None</p>");
out.write(buf.toString());
out.flush();
buf.setLength(0);
}
private void renderIPGroups16(Writer out, StringBuilder buf, List<RouterInfo> ris, Map<Hash, Points> points) throws IOException {
buf.append("<h3 id=\"same16\">Floodfills in the Same /16 (4 minimum)</h3>");
buf.append("<h3 id=\"same16\" class=\"sybils\">Floodfills in the Same /16 (4 minimum)</h3>");
ObjectCounter<Integer> oc = new ObjectCounter<Integer>();
for (RouterInfo info : ris) {
byte[] ip = getIP(info);
@ -543,7 +543,7 @@ class SybilRenderer {
int i = ii.intValue();
int i0 = i >> 8;
int i1 = i & 0xff;
buf.append("<p><b>").append(count).append(" floodfills in ").append(i0).append('.')
buf.append("<p class=\"sybil_floodfill\"><b>").append(count).append(" floodfills in ").append(i0).append('.')
.append(i1).append(".0.0/16</b></p>");
for (RouterInfo info : ris) {
byte[] ip = getIP(info);
@ -561,14 +561,14 @@ class SybilRenderer {
}
}
if (!found)
buf.append("<p>None</p>");
buf.append("<p class=\"notfound\">None</p>");
out.write(buf.toString());
out.flush();
buf.setLength(0);
}
private void renderIPGroupsFamily(Writer out, StringBuilder buf, List<RouterInfo> ris, Map<Hash, Points> points) throws IOException {
buf.append("<h3>Floodfills in the Same Declared Family</h3>");
buf.append("<h3 id=\"samefamily\" class=\"sybils\">Floodfills in the Same Declared Family</h3>");
ObjectCounter<String> oc = new ObjectCounter<String>();
for (RouterInfo info : ris) {
String fam = info.getOption("family");
@ -581,7 +581,7 @@ class SybilRenderer {
boolean found = false;
for (String s : foo) {
int count = oc.count(s);
buf.append("<p><b>").append(count).append(" floodfills in declared family \"").append(DataHelper.escapeHTML(s) + '"')
buf.append("<p id=\"family\"><b>").append(count).append(" floodfills in declared family \"").append(DataHelper.escapeHTML(s) + '"')
.append("</b></p>");
for (RouterInfo info : ris) {
String fam = info.getOption("family");
@ -600,7 +600,7 @@ class SybilRenderer {
}
}
if (!found)
buf.append("<p>None</p>");
buf.append("<p class=\"notfound\">None</p>");
out.write(buf.toString());
out.flush();
buf.setLength(0);
@ -725,7 +725,7 @@ class SybilRenderer {
break;
}
double avg = tot / count;
buf.append("<p><b>Totals for " + count + " floodfills: </b>MIN=" + fmt.format(min) + " AVG=" + fmt.format(avg) + " MEDIAN=" + fmt.format(median) + " MAX=" + fmt.format(max) + "</p>\n");
buf.append("<p id=\"sybil_totals\"><b>Totals for " + count + " floodfills: </b>MIN=" + fmt.format(min) + " AVG=" + fmt.format(avg) + " MEDIAN=" + fmt.format(median) + " MAX=" + fmt.format(max) + "</p>\n");
out.write(buf.toString());
out.flush();
buf.setLength(0);

View File

@ -33,7 +33,7 @@ class TunnelRenderer {
}
public void renderStatusHTML(Writer out) throws IOException {
out.write("<div class=\"wideload\"><h2><a name=\"exploratory\" ></a>" + _t("Exploratory tunnels") + " (<a href=\"/configtunnels#exploratory\">" + _t("configure") + "</a>)</h2>\n");
out.write("<h3 class=\"tabletitle\" id=\"exploratorytunnels\"><a name=\"exploratory\" ></a>" + _t("Exploratory tunnels") + " (<a href=\"/configtunnels#exploratory\">" + _t("configure") + "</a>)</h3>\n");
renderPool(out, _context.tunnelManager().getInboundExploratoryPool(), _context.tunnelManager().getOutboundExploratoryPool());
List<Hash> destinations = null;
@ -54,20 +54,20 @@ class TunnelRenderer {
name = outPool.getSettings().getDestinationNickname();
if (name == null)
name = client.toBase64().substring(0,4);
out.write("<h2><a name=\"" + client.toBase64().substring(0,4)
out.write("<h3 class=\"tabletitle\"><a name=\"" + client.toBase64().substring(0,4)
+ "\" ></a>" + _t("Client tunnels for") + ' ' + DataHelper.escapeHTML(_t(name)));
if (isLocal)
out.write(" (<a href=\"/configtunnels#" + client.toBase64().substring(0,4) +"\">" + _t("configure") + "</a>)</h2>\n");
out.write(" (<a href=\"/configtunnels#" + client.toBase64().substring(0,4) +"\">" + _t("configure") + "</a>)</h3>\n");
else
out.write(" (" + _t("dead") + ")</h2>\n");
out.write(" (" + _t("dead") + ")</h3>\n");
renderPool(out, in, outPool);
}
List<HopConfig> participating = _context.tunnelDispatcher().listParticipatingTunnels();
out.write("<h2><a name=\"participating\"></a>" + _t("Participating tunnels") + "</h2>\n");
out.write("<h3 class=\"tabletitle\"><a name=\"participating\"></a>" + _t("Participating tunnels") + "</h3>\n");
if (!participating.isEmpty()) {
Collections.sort(participating, new TunnelComparator());
out.write("<table><tr><th>" + _t("Receive on") + "</th><th>" + _t("From") + "</th><th>"
out.write("<table class=\"tunneldisplay\"><tr><th>" + _t("Receive on") + "</th><th>" + _t("From") + "</th><th>"
+ _t("Send on") + "</th><th>" + _t("To") + "</th><th>" + _t("Expiration") + "</th>"
+ "<th>" + _t("Usage") + "</th><th>" + _t("Rate") + "</th><th>" + _t("Role") + "</th></tr>\n");
}
@ -136,7 +136,6 @@ class TunnelRenderer {
out.write("<div class=\"statusnotes\"><b>" + _t("none") + "</b></div>\n");
out.write("<div class=\"statusnotes\"><b>" + _t("Lifetime bandwidth usage") + ": " + DataHelper.formatSize2(processed*1024) + "B</b></div>\n");
//renderPeers(out);
out.write("</div>");
}
private static class TunnelComparator implements Comparator<HopConfig>, Serializable {
@ -164,7 +163,7 @@ class TunnelRenderer {
if (info.getLength() > maxLength)
maxLength = info.getLength();
}
out.write("<table><tr><th>" + _t("In/Out") + "</th><th>" + _t("Expiry") + "</th><th>" + _t("Usage") + "</th><th>" + _t("Gateway") + "</th>");
out.write("<table class=\"tunneldisplay\"><tr><th>" + _t("In/Out") + "</th><th>" + _t("Expiry") + "</th><th>" + _t("Usage") + "</th><th>" + _t("Gateway") + "</th>");
if (maxLength > 3) {
out.write("<th align=\"center\" colspan=\"" + (maxLength - 2));
out.write("\">" + _t("Participants") + "</th>");