Changeset 0cd67ac for apps


Ignore:
Timestamp:
Oct 6, 2018 10:59:58 PM (22 months ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
477fa9e
Parents:
aafccc0
Message:

Console: /netdb fixes (ticket #2326):

  • 'O' cap search won't include P/X
  • Fix highlighted tab for transport search
  • Use POST instead of GET
Location:
apps/routerconsole/java/src/net/i2p/router/web/helpers
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • apps/routerconsole/java/src/net/i2p/router/web/helpers/NetDbHelper.java

    raafccc0 r0cd67ac  
    223223            _family != null || _caps != null || _ip != null || _sybil != null ||
    224224            _port != 0 || _type != null || _mtu != null || _ipv6 != null ||
    225             _ssucaps != null || _cost != 0)
     225            _ssucaps != null || _transport != null || _cost != 0)
    226226            return 2;
    227227        if (_full == 2)
     
    277277     */
    278278    private void renderLookupForm() throws IOException {
    279         _out.write("<form action=\"/netdb\" method=\"GET\">\n" +
     279        _out.write("<form action=\"/netdb\" method=\"POST\">\n" +
    280280                   "<table id=\"netdblookup\"><tr><th colspan=\"3\">Network Database Search</th></tr>\n" +
    281281                   "<tr><td colspan=\"3\" class=\"subheading\"><b>Enter one search field <i>only</i>:</b></td></tr>\n" +
  • apps/routerconsole/java/src/net/i2p/router/web/helpers/NetDbRenderer.java

    raafccc0 r0cd67ac  
    174174                    (country != null && country.equals(_context.commSystem().getCountry(key))) ||
    175175                    (family != null && family.equals(ri.getOption("family"))) ||
    176                     (caps != null && ri.getCapabilities().contains(caps)) ||
     176                    // 'O' will catch PO and XO also
     177                    (caps != null && hasCap(ri, caps)) ||
    177178                    (tr != null && ri.getTargetAddress(tr) != null) ||
    178179                    (type != null && type == ri.getIdentity().getSigType())) {
     
    356357        if (sybil != null)
    357358            SybilRenderer.renderSybilHTML(out, _context, sybils, sybil);
     359    }
     360
     361    /**
     362     *  Special handling for 'O' cap
     363     *  @param caps non-null
     364     *  @since 0.9.38
     365     */
     366    private static boolean hasCap(RouterInfo ri, String caps) {
     367        String ricaps = ri.getCapabilities();
     368        if (caps.equals("O")) {
     369            return ricaps.contains(caps) &&
     370                   !ricaps.contains("P") &&
     371                   !ricaps.contains("X");
     372        } else {
     373            return ricaps.contains(caps);
     374        }
    358375    }
    359376
Note: See TracChangeset for help on using the changeset viewer.