From 5353fd986ee7310ec5ad805462309051d9a67d8c Mon Sep 17 00:00:00 2001 From: str4d Date: Sun, 9 Apr 2017 06:27:41 +0000 Subject: [PATCH] Tidy up /profiles, add definitions for capabilities --- .../router/web/ProfileOrganizerRenderer.java | 107 ++++++++++++++---- 1 file changed, 84 insertions(+), 23 deletions(-) diff --git a/apps/routerconsole/java/src/net/i2p/router/web/ProfileOrganizerRenderer.java b/apps/routerconsole/java/src/net/i2p/router/web/ProfileOrganizerRenderer.java index b225df4ae..01ff4f615 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/ProfileOrganizerRenderer.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/ProfileOrganizerRenderer.java @@ -88,12 +88,13 @@ class ProfileOrganizerRenderer { buf.append(""); buf.append(""); buf.append(""); - buf.append(""); + buf.append(""); + buf.append(""); buf.append(""); buf.append(""); buf.append(""); buf.append(""); - buf.append(""); + buf.append(""); buf.append(""); int prevTier = 1; for (PeerProfile prof : order) { @@ -119,7 +120,7 @@ class ProfileOrganizerRenderer { } if (tier != prevTier) - buf.append("\n"); + buf.append("\n"); prevTier = tier; buf.append(""); } - - buf.append("\n"); + buf.append(" +-\n"); buf.append(""); // let's not build the whole page in memory (~500 bytes per peer) out.write(buf.toString()); @@ -260,23 +261,79 @@ class ProfileOrganizerRenderer { if (mode < 2) { buf.append("

").append(_t("Thresholds")).append("

\n") - .append("
").append(_t("Peer")).append("").append(_t("Groups (Caps)")).append("").append(_t("Groups")).append("").append(_t("Caps")).append("").append(_t("Speed")).append("").append(_t("Capacity")).append("").append(_t("Integration")).append("").append(_t("Status")).append(" ").append(_t("View/Edit")).append("


"); @@ -139,14 +140,14 @@ class ProfileOrganizerRenderer { RouterInfo info = _context.netDb().lookupRouterInfoLocally(peer); if (info != null) { // prevent HTML injection in the caps and version - buf.append(" (").append(DataHelper.stripHTML(info.getCapabilities())); + buf.append("").append(DataHelper.stripHTML(info.getCapabilities())); String v = info.getOption("router.version"); if (v != null) buf.append(' ').append(DataHelper.stripHTML(v)); - buf.append(')'); + } else { + buf.append("").append(_t("unknown")).append("").append(num(prof.getSpeedValue())); + buf.append("").append(num(prof.getSpeedValue())); long bonus = prof.getSpeedBonus(); if (bonus != 0) { if (bonus > 0) @@ -183,7 +184,7 @@ class ProfileOrganizerRenderer { // .append(peer.toBase64().substring(0,6)).append("\">").append(_t("profile")).append(""); buf.append("").append(_t("profile")).append(""); - buf.append(" +-
"); - buf.append("

").append(_t("Speed")).append(": ").append(num(_organizer.getSpeedThreshold())) - .append(" (").append(fast).append(' ').append(_t("fast peers")).append(")
"); - buf.append("").append(_t("Capacity")).append(": ").append(num(_organizer.getCapacityThreshold())) - .append(" (").append(reliable).append(' ').append(_t("high capacity peers")).append(")
"); - buf.append("").append(_t("Integration")).append(": ").append(num(_organizer.getIntegrationThreshold())) - .append(" (").append(integrated).append(' ').append(_t(" well integrated peers")).append(")") + .append("") + .append("
") + .append(_t("Speed")).append(": ").append(num(_organizer.getSpeedThreshold())) + .append("") + .append(_t("Capacity")).append(": ").append(num(_organizer.getCapacityThreshold())) + .append("") + .append(_t("Integration")).append(": ").append(num(_organizer.getIntegrationThreshold())) + .append("
") + .append(fast).append(' ').append(_t("fast peers")) + .append("") + .append(reliable).append(' ').append(_t("high capacity peers")) + .append("") + .append(integrated).append(' ').append(_t(" well integrated peers")) .append("
\n"); buf.append("

").append(_t("Definitions")).append("

\n") - .append("
    "); - buf.append("
  • ").append(_t("groups")).append(": ").append(_t("as determined by the profile organizer")).append("
  • "); - buf.append("
  • ").append(_t("caps")).append(": ").append(_t("capabilities in the netDb, not used to determine profiles")).append("
  • "); - buf.append("
  • ").append(_t("speed")).append(": ").append(_t("peak throughput (bytes per second) over a 1 minute period that the peer has sustained in a single tunnel")).append("
  • "); - buf.append("
  • ").append(_t("capacity")).append(": ").append(_t("how many tunnels can we ask them to join in an hour?")).append("
  • "); - buf.append("
  • ").append(_t("integration")).append(": ").append(_t("how many new peers have they told us about lately?")).append("
  • "); - buf.append("
  • ").append(_t("status")).append(": ").append(_t("is the peer banned, or unreachable, or failing tunnel tests?")).append("
  • "); - buf.append("
\n"); + .append(""); + buf.append(""); + buf.append(""); + buf.append(""); // profile_defs + buf.append(""); + buf.append(""); + buf.append(""); + buf.append(""); + buf.append(""); + buf.append("
") + .append(_t("groups")).append(":").append(_t("as determined by the profile organizer")) + .append("
") + .append(_t("caps")).append(":").append(_t("capabilities in the netDb, not used to determine profiles")) + .append("
"); + buf.append("") + .append("") + .append("") + .append(""); + buf.append("") + .append("") + .append("") + .append(""); + buf.append("") + .append("") + .append("") + .append(""); + buf.append("") + .append("") + .append("") + .append(""); + buf.append("") + .append("") + .append("") + .append(""); + buf.append("") + .append("") + .append("") + .append(""); + buf.append("") + .append("") + .append(""); + buf.append("
 B:").append(_t("SSU Testing")).append("C:").append(_t("SSU Introducer")).append(" 
 f:").append(_t("Floodfill")).append("H:").append(_t("Hidden")).append(" 
 K:").append(_t("Under {0} shared bandwidth", "12KBps")).append("L:").append(_t("{0} shared bandwidth", "12 - 32KBps")).append(" 
 M:").append(_t("{0} shared bandwidth", "32 - 64KBps")).append("N:").append(_t("{0} shared bandwidth", "64 - 128KBps")).append(" 
 O:").append(_t("{0} shared bandwidth", "128 - 256KBps")).append("P:").append(_t("{0} shared bandwidth", "256 - 2000KBps")).append(" 
 R:").append(_t("Reachable")).append("U:").append(_t("Unreachable")).append(" 
 X:").append(_t("Over {0} shared bandwidth", "2000KBps")).append("   
").append(_t("Note: For P and X bandwidth capabilities, O is included for the purpose of backward compatibility")).append("
") + .append(_t("speed")) + .append(":") + .append(_t("peak throughput (bytes per second) over a 1 minute period that the peer has sustained in a single tunnel")) + .append("
") + .append(_t("capacity")) + .append(":") + .append(_t("how many tunnels can we ask them to join in an hour?")) + .append("
") + .append(_t("integration")) + .append(":") + .append(_t("how many new peers have they told us about lately?")) + .append("
") + .append(_t("status")) + .append(":") + .append(_t("is the peer banned, or unreachable, or failing tunnel tests?")) + .append("
\n"); // thresholds //// //// don't bother reindenting @@ -382,6 +439,10 @@ class ProfileOrganizerRenderer { return Messages.getString(s, _context); } + private String _t(String s, Object o) { + return Messages.getString(s, o, _context); + } + /** translate (ngettext) @since 0.8.5 */ public String ngettext(String s, String p, int n) { return Messages.getString(n, s, p, _context);