forked from I2P_Developers/i2p.i2p
Console: /netdb fixes (ticket #2326):
- 'O' cap search won't include P/X - Fix highlighted tab for transport search - Use POST instead of GET
This commit is contained in:
@ -222,7 +222,7 @@ public class NetDbHelper extends HelperBase {
|
|||||||
if (_routerPrefix != null || _version != null || _country != null ||
|
if (_routerPrefix != null || _version != null || _country != null ||
|
||||||
_family != null || _caps != null || _ip != null || _sybil != null ||
|
_family != null || _caps != null || _ip != null || _sybil != null ||
|
||||||
_port != 0 || _type != null || _mtu != null || _ipv6 != null ||
|
_port != 0 || _type != null || _mtu != null || _ipv6 != null ||
|
||||||
_ssucaps != null || _cost != 0)
|
_ssucaps != null || _transport != null || _cost != 0)
|
||||||
return 2;
|
return 2;
|
||||||
if (_full == 2)
|
if (_full == 2)
|
||||||
return 3;
|
return 3;
|
||||||
@ -276,7 +276,7 @@ public class NetDbHelper extends HelperBase {
|
|||||||
* @since 0.9.28
|
* @since 0.9.28
|
||||||
*/
|
*/
|
||||||
private void renderLookupForm() throws IOException {
|
private void renderLookupForm() throws IOException {
|
||||||
_out.write("<form action=\"/netdb\" method=\"GET\">\n" +
|
_out.write("<form action=\"/netdb\" method=\"POST\">\n" +
|
||||||
"<table id=\"netdblookup\"><tr><th colspan=\"3\">Network Database Search</th></tr>\n" +
|
"<table id=\"netdblookup\"><tr><th colspan=\"3\">Network Database Search</th></tr>\n" +
|
||||||
"<tr><td colspan=\"3\" class=\"subheading\"><b>Enter one search field <i>only</i>:</b></td></tr>\n" +
|
"<tr><td colspan=\"3\" class=\"subheading\"><b>Enter one search field <i>only</i>:</b></td></tr>\n" +
|
||||||
"<tr><td>Capabilities:</td><td><input type=\"text\" name=\"caps\"></td><td>e.g. f or XOfR</td></tr>\n" +
|
"<tr><td>Capabilities:</td><td><input type=\"text\" name=\"caps\"></td><td>e.g. f or XOfR</td></tr>\n" +
|
||||||
|
@ -173,7 +173,8 @@ class NetDbRenderer {
|
|||||||
(version != null && version.equals(ri.getVersion())) ||
|
(version != null && version.equals(ri.getVersion())) ||
|
||||||
(country != null && country.equals(_context.commSystem().getCountry(key))) ||
|
(country != null && country.equals(_context.commSystem().getCountry(key))) ||
|
||||||
(family != null && family.equals(ri.getOption("family"))) ||
|
(family != null && family.equals(ri.getOption("family"))) ||
|
||||||
(caps != null && ri.getCapabilities().contains(caps)) ||
|
// 'O' will catch PO and XO also
|
||||||
|
(caps != null && hasCap(ri, caps)) ||
|
||||||
(tr != null && ri.getTargetAddress(tr) != null) ||
|
(tr != null && ri.getTargetAddress(tr) != null) ||
|
||||||
(type != null && type == ri.getIdentity().getSigType())) {
|
(type != null && type == ri.getIdentity().getSigType())) {
|
||||||
if (skipped < toSkip) {
|
if (skipped < toSkip) {
|
||||||
@ -357,6 +358,22 @@ class NetDbRenderer {
|
|||||||
SybilRenderer.renderSybilHTML(out, _context, sybils, sybil);
|
SybilRenderer.renderSybilHTML(out, _context, sybils, sybil);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Special handling for 'O' cap
|
||||||
|
* @param caps non-null
|
||||||
|
* @since 0.9.38
|
||||||
|
*/
|
||||||
|
private static boolean hasCap(RouterInfo ri, String caps) {
|
||||||
|
String ricaps = ri.getCapabilities();
|
||||||
|
if (caps.equals("O")) {
|
||||||
|
return ricaps.contains(caps) &&
|
||||||
|
!ricaps.contains("P") &&
|
||||||
|
!ricaps.contains("X");
|
||||||
|
} else {
|
||||||
|
return ricaps.contains(caps);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param debug @since 0.7.14 sort by distance from us, display
|
* @param debug @since 0.7.14 sort by distance from us, display
|
||||||
* median distance, and other stuff, useful when floodfill
|
* median distance, and other stuff, useful when floodfill
|
||||||
|
Reference in New Issue
Block a user