diff --git a/apps/routerconsole/java/src/net/i2p/router/update/NewsFetcher.java b/apps/routerconsole/java/src/net/i2p/router/update/NewsFetcher.java index edd3ddbae0ae0a5033a7bfa8f27a2fc9541442ee..9de3156b1297ad0587eec5a96b4132816bc3fb95 100644 --- a/apps/routerconsole/java/src/net/i2p/router/update/NewsFetcher.java +++ b/apps/routerconsole/java/src/net/i2p/router/update/NewsFetcher.java @@ -73,7 +73,7 @@ class NewsFetcher extends UpdateRunner { } public void fetchNews() { - boolean shouldProxy = Boolean.valueOf(_context.getProperty(ConfigUpdateHandler.PROP_SHOULD_PROXY, ConfigUpdateHandler.DEFAULT_SHOULD_PROXY)).booleanValue(); + boolean shouldProxy = _context.getProperty(ConfigUpdateHandler.PROP_SHOULD_PROXY_NEWS, ConfigUpdateHandler.DEFAULT_SHOULD_PROXY_NEWS); String proxyHost = _context.getProperty(ConfigUpdateHandler.PROP_PROXY_HOST, ConfigUpdateHandler.DEFAULT_PROXY_HOST); int proxyPort = ConfigUpdateHandler.proxyPort(_context); diff --git a/apps/routerconsole/java/src/net/i2p/router/update/PluginUpdateRunner.java b/apps/routerconsole/java/src/net/i2p/router/update/PluginUpdateRunner.java index a7646afc799be03e4359c367f47386b53d778257..78e03e03652b5792a40f28d8f687c05d6d923500 100644 --- a/apps/routerconsole/java/src/net/i2p/router/update/PluginUpdateRunner.java +++ b/apps/routerconsole/java/src/net/i2p/router/update/PluginUpdateRunner.java @@ -98,7 +98,7 @@ class PluginUpdateRunner extends UpdateRunner { } else { updateStatus("<b>" + _("Downloading plugin from {0}", _xpi2pURL) + "</b>"); // use the same settings as for updater - boolean shouldProxy = Boolean.valueOf(_context.getProperty(ConfigUpdateHandler.PROP_SHOULD_PROXY, ConfigUpdateHandler.DEFAULT_SHOULD_PROXY)).booleanValue(); + boolean shouldProxy = _context.getProperty(ConfigUpdateHandler.PROP_SHOULD_PROXY, ConfigUpdateHandler.DEFAULT_SHOULD_PROXY); String proxyHost = _context.getProperty(ConfigUpdateHandler.PROP_PROXY_HOST, ConfigUpdateHandler.DEFAULT_PROXY_HOST); int proxyPort = ConfigUpdateHandler.proxyPort(_context); try { diff --git a/apps/routerconsole/java/src/net/i2p/router/update/UpdateRunner.java b/apps/routerconsole/java/src/net/i2p/router/update/UpdateRunner.java index c3b388db2a47fb7552c5990a9f0fc61814bb7519..98055fa2df57a8519ac2593ea02084ccd9f80752 100644 --- a/apps/routerconsole/java/src/net/i2p/router/update/UpdateRunner.java +++ b/apps/routerconsole/java/src/net/i2p/router/update/UpdateRunner.java @@ -149,7 +149,7 @@ class UpdateRunner extends I2PAppThread implements UpdateTask, EepGet.StatusList int proxyPort; boolean isSSL = false; if (_method == HTTP) { - shouldProxy = Boolean.valueOf(_context.getProperty(ConfigUpdateHandler.PROP_SHOULD_PROXY, ConfigUpdateHandler.DEFAULT_SHOULD_PROXY)).booleanValue(); + shouldProxy = _context.getProperty(ConfigUpdateHandler.PROP_SHOULD_PROXY, ConfigUpdateHandler.DEFAULT_SHOULD_PROXY); proxyHost = _context.getProperty(ConfigUpdateHandler.PROP_PROXY_HOST, ConfigUpdateHandler.DEFAULT_PROXY_HOST); proxyPort = ConfigUpdateHandler.proxyPort(_context); } else if (_method == HTTP_CLEARNET) { diff --git a/apps/routerconsole/java/src/net/i2p/router/web/ConfigUpdateHandler.java b/apps/routerconsole/java/src/net/i2p/router/web/ConfigUpdateHandler.java index 72486b68bc9b9c9bf9cd4b5c7298b900c582403b..abbddd0833a22350deee0bbff4fc354f4cdf9332 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/ConfigUpdateHandler.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/ConfigUpdateHandler.java @@ -23,6 +23,7 @@ public class ConfigUpdateHandler extends FormHandler { private String _proxyHost; private String _proxyPort; private boolean _updateThroughProxy; + private boolean _newsThroughProxy; private String _trustedKeys; private boolean _updateUnsigned; private String _zipURL; @@ -37,7 +38,11 @@ public class ConfigUpdateHandler extends FormHandler { public static final String PROP_UPDATE_POLICY = "router.updatePolicy"; public static final String DEFAULT_UPDATE_POLICY = "download"; public static final String PROP_SHOULD_PROXY = "router.updateThroughProxy"; - public static final String DEFAULT_SHOULD_PROXY = Boolean.TRUE.toString(); + public static final boolean DEFAULT_SHOULD_PROXY = true; + /** @since 0.9.9 */ + public static final String PROP_SHOULD_PROXY_NEWS = "router.fetchNewsThroughProxy"; + /** @since 0.9.9 */ + public static final boolean DEFAULT_SHOULD_PROXY_NEWS = true; public static final String PROP_PROXY_HOST = "router.updateProxyHost"; public static final String DEFAULT_PROXY_HOST = "127.0.0.1"; public static final String PROP_PROXY_PORT = "router.updateProxyPort"; @@ -164,6 +169,8 @@ public class ConfigUpdateHandler extends FormHandler { Map<String, String> changes = new HashMap(); if ( (_newsURL != null) && (_newsURL.length() > 0) ) { + if (_newsURL.startsWith("https")) + _newsThroughProxy = false; String oldURL = ConfigUpdateHelper.getNewsURL(_context); if ( (oldURL == null) || (!_newsURL.equals(oldURL)) ) { changes.put(PROP_NEWS_URL, _newsURL); @@ -189,8 +196,9 @@ public class ConfigUpdateHandler extends FormHandler { } } - changes.put(PROP_SHOULD_PROXY, "" + _updateThroughProxy); - changes.put(PROP_UPDATE_UNSIGNED, "" + _updateUnsigned); + changes.put(PROP_SHOULD_PROXY, Boolean.toString(_updateThroughProxy)); + changes.put(PROP_SHOULD_PROXY_NEWS, Boolean.toString(_newsThroughProxy)); + changes.put(PROP_UPDATE_UNSIGNED, Boolean.toString(_updateUnsigned)); String oldFreqStr = _context.getProperty(PROP_REFRESH_FREQUENCY, DEFAULT_REFRESH_FREQUENCY); long oldFreq = DEFAULT_REFRESH_FREQ; @@ -252,4 +260,6 @@ public class ConfigUpdateHandler extends FormHandler { public void setProxyPort(String port) { _proxyPort = port; } public void setUpdateUnsigned(String foo) { _updateUnsigned = true; } public void setZipURL(String url) { _zipURL = url; } + /** @since 0.9.9 */ + public void setNewsThroughProxy(String foo) { _newsThroughProxy = true; } } diff --git a/apps/routerconsole/java/src/net/i2p/router/web/ConfigUpdateHelper.java b/apps/routerconsole/java/src/net/i2p/router/web/ConfigUpdateHelper.java index 7fecfc85f57ff10ee1912054532d406970f90133..037acb8bc95dc39cbf327a4f139e9e1ef2afbcec 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/ConfigUpdateHelper.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/ConfigUpdateHelper.java @@ -73,13 +73,20 @@ public class ConfigUpdateHelper extends HelperBase { } public String getUpdateThroughProxy() { - String proxy = _context.getProperty(ConfigUpdateHandler.PROP_SHOULD_PROXY, ConfigUpdateHandler.DEFAULT_SHOULD_PROXY); - if (Boolean.parseBoolean(proxy)) + if (_context.getProperty(ConfigUpdateHandler.PROP_SHOULD_PROXY, ConfigUpdateHandler.DEFAULT_SHOULD_PROXY)) return "<input type=\"checkbox\" class=\"optbox\" value=\"true\" name=\"updateThroughProxy\" checked=\"checked\" >"; else return "<input type=\"checkbox\" class=\"optbox\" value=\"true\" name=\"updateThroughProxy\" >"; } + /** @since 0.9.9 */ + public String getNewsThroughProxy() { + if (_context.getProperty(ConfigUpdateHandler.PROP_SHOULD_PROXY_NEWS, ConfigUpdateHandler.DEFAULT_SHOULD_PROXY_NEWS)) + return "<input type=\"checkbox\" class=\"optbox\" value=\"true\" name=\"newsThroughProxy\" checked=\"checked\" >"; + else + return "<input type=\"checkbox\" class=\"optbox\" value=\"true\" name=\"newsThroughProxy\" >"; + } + public String getUpdateUnsigned() { if (_context.getBooleanProperty(ConfigUpdateHandler.PROP_UPDATE_UNSIGNED)) return "<input type=\"checkbox\" class=\"optbox\" value=\"true\" name=\"updateUnsigned\" checked=\"checked\" >"; diff --git a/apps/routerconsole/jsp/configupdate.jsp b/apps/routerconsole/jsp/configupdate.jsp index 2fd5e653607aa6e33d09353babd5ca56ac889676..c29a9a95dac00549968b019fc17aa3d9125a63d6 100644 --- a/apps/routerconsole/jsp/configupdate.jsp +++ b/apps/routerconsole/jsp/configupdate.jsp @@ -48,6 +48,8 @@ <tr><td class="mediumtags" align="right"><b><%=formhandler._("Update policy")%>:</b></td> <td><jsp:getProperty name="updatehelper" property="updatePolicySelectBox" /></td></tr> <% } // if canInstall %> + <tr><td class="mediumtags" align="right"><b><%=intl._("Fetch news through the eepProxy?")%></b></td> + <td><jsp:getProperty name="updatehelper" property="newsThroughProxy" /></td></tr> <tr><td class="mediumtags" align="right"><b><%=intl._("Update through the eepProxy?")%></b></td> <td><jsp:getProperty name="updatehelper" property="updateThroughProxy" /></td></tr> <% if (updatehelper.isAdvanced()) { %>