forked from I2P_Developers/i2p.i2p
Console: Sort addresses in RIs, remove note about O cap
This commit is contained in:
@ -784,6 +784,27 @@ class NetDbRenderer {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort by style, then host
|
||||
* @since 0.9.38
|
||||
*/
|
||||
private static class RAComparator implements Comparator<RouterAddress> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public int compare(RouterAddress l, RouterAddress r) {
|
||||
int rv = l.getTransportStyle().compareTo(r.getTransportStyle());
|
||||
if (rv != 0)
|
||||
return rv;
|
||||
String lh = l.getHost();
|
||||
String rh = r.getHost();
|
||||
if (lh == null)
|
||||
return (rh == null) ? 0 : -1;
|
||||
if (rh == null)
|
||||
return 1;
|
||||
return lh.compareTo(rh);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Be careful to use stripHTML for any displayed routerInfo data
|
||||
* to prevent vulnerabilities
|
||||
@ -836,7 +857,13 @@ class NetDbRenderer {
|
||||
if (addrs.isEmpty()) {
|
||||
buf.append(_t("none"));
|
||||
} else {
|
||||
for (RouterAddress addr : info.getAddresses()) {
|
||||
if (addrs.size() > 1) {
|
||||
// addrs is unmodifiable
|
||||
List<RouterAddress> laddrs = new ArrayList<RouterAddress>(addrs);
|
||||
Collections.sort(laddrs, new RAComparator());
|
||||
addrs = laddrs;
|
||||
}
|
||||
for (RouterAddress addr : addrs) {
|
||||
String style = addr.getTransportStyle();
|
||||
buf.append("<br><b class=\"netdb_transport\">").append(DataHelper.stripHTML(style)).append(":</b>");
|
||||
int cost = addr.getCost();
|
||||
|
@ -330,8 +330,6 @@ class ProfileOrganizerRenderer {
|
||||
buf.append("<tr><td> </td>")
|
||||
.append("<td><b>X</b></td><td>").append(_t("Over {0} shared bandwidth", Math.round(Router.MIN_BW_X * 1.024f) + " KBps")).append("</td>")
|
||||
.append("<td> </td><td> </td><td> </td></tr>");
|
||||
buf.append("<tr><td> </td><td colspan=\"5\">").append(_t("Note: For P and X bandwidth tiers, O is included for the purpose of backward compatibility in the NetDB."))
|
||||
.append("</tr>");
|
||||
buf.append("</tbody></table></td></tr>"); // profile_defs
|
||||
buf.append("<tr><td><b>")
|
||||
.append(_t("speed"))
|
||||
|
Reference in New Issue
Block a user