diff --git a/apps/routerconsole/java/src/net/i2p/router/web/ConfigReseedHelper.java b/apps/routerconsole/java/src/net/i2p/router/web/ConfigReseedHelper.java index 0bacd172a..80907610c 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/ConfigReseedHelper.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/ConfigReseedHelper.java @@ -78,7 +78,7 @@ public class ConfigReseedHelper extends HelperBase { return getChecked(Reseeder.PROP_SPROXY_AUTH_ENABLE); } - public String getReseedURL() { + private List reseedList() { String urls = _context.getProperty(Reseeder.PROP_RESEED_URL, Reseeder.DEFAULT_SEED_URL + ',' + Reseeder.DEFAULT_SSL_SEED_URL); StringTokenizer tok = new StringTokenizer(urls, " ,\r\n"); List URLList = new ArrayList(16); @@ -87,6 +87,11 @@ public class ConfigReseedHelper extends HelperBase { if (s.length() > 0) URLList.add(s); } + return URLList; + } + + public String getReseedURL() { + List URLList = reseedList(); Collections.sort(URLList); StringBuilder buf = new StringBuilder(); for (String s : URLList) { @@ -96,4 +101,49 @@ public class ConfigReseedHelper extends HelperBase { } return buf.toString(); } + + /** + * @return true only if we have both http and https URLs + * @since 0.9.33 + */ + public boolean shouldShowSelect() { + boolean http = false; + boolean https = false; + for (String u : reseedList()) { + if (u.startsWith("https://")) { + if (http) + return true; + https = true; + } else if (u.startsWith("http://")) { + if (https) + return true; + http = true; + } + } + return false; + } + + /** + * @return true only if we have a http URL + * @since 0.9.33 + */ + public boolean shouldShowHTTPProxy() { + for (String u : reseedList()) { + if (u.startsWith("http://")) + return true; + } + return false; + } + + /** + * @return true only if we have a https URL + * @since 0.9.33 + */ + public boolean shouldShowHTTPSProxy() { + for (String u : reseedList()) { + if (u.startsWith("https://")) + return true; + } + return false; + } } diff --git a/apps/routerconsole/jsp/configreseed.jsp b/apps/routerconsole/jsp/configreseed.jsp index 38ca7f0e3..1fbc2dda2 100644 --- a/apps/routerconsole/jsp/configreseed.jsp +++ b/apps/routerconsole/jsp/configreseed.jsp @@ -92,6 +92,8 @@ <%=intl._t("Change these only if HTTPS is blocked by a restrictive firewall and reseed has failed.")%> + +<% if (reseedHelper.shouldShowSelect()) { %> <%=intl._t("Reseed URL Selection")%>:
@@ -99,11 +101,14 @@ <%=intl._t("Use SSL only")%>
+<% } // shouldShowSelect %> + <%=intl._t("Reseed URLs")%>:
" />
+<% if (reseedHelper.shouldShowHTTPProxy()) { %> > <%=intl._t("HTTP Proxy Host")%>: @@ -117,8 +122,10 @@ " > <%=intl._t("HTTP Proxy Password")%>: " > +<% } // shouldShowHTTPProxy %>