Console: Sort addresses in RIs, remove note about O cap

This commit is contained in:
zzz
2018-10-06 13:25:22 +00:00
parent e528775768
commit 960636c6bf
4 changed files with 32 additions and 4 deletions

View File

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

View File

@ -330,8 +330,6 @@ class ProfileOrganizerRenderer {
buf.append("<tr><td>&nbsp;</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>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>");
buf.append("<tr><td>&nbsp;</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"))