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 1729a209be0b5faf436156f3fe66dd0865ad485a..9366591fca2beeebd8b319f24ea9accead36a942 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/ConfigUpdateHandler.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/ConfigUpdateHandler.java @@ -19,7 +19,8 @@ public class ConfigUpdateHandler extends FormHandler { public static final String PROP_NEWS_URL = "router.newsURL"; // public static final String DEFAULT_NEWS_URL = "http://dev.i2p.net/cgi-bin/cvsweb.cgi/i2p/news.xml?rev=HEAD"; - public static final String DEFAULT_NEWS_URL = "http://complication.i2p/news.xml"; + public static final String OLD_DEFAULT_NEWS_URL = "http://complication.i2p/news.xml"; + public static final String DEFAULT_NEWS_URL = "http://echelon.i2p/i2p/news.xml"; public static final String PROP_REFRESH_FREQUENCY = "router.newsRefreshFrequency"; public static final String DEFAULT_REFRESH_FREQUENCY = 24*60*60*1000 + ""; public static final String PROP_UPDATE_POLICY = "router.updatePolicy"; @@ -57,7 +58,7 @@ public class ConfigUpdateHandler extends FormHandler { } if ( (_newsURL != null) && (_newsURL.length() > 0) ) { - String oldURL = _context.router().getConfigSetting(PROP_NEWS_URL); + String oldURL = ConfigUpdateHelper.getNewsURL(_context); if ( (oldURL == null) || (!_newsURL.equals(oldURL)) ) { _context.router().setConfigSetting(PROP_NEWS_URL, _newsURL); addFormNotice("Updating news URL to " + _newsURL); 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 d0d2437994d567cafbf58106fa0f6f795888ce14..4aac71dff71fca59478df3411829fd6da64fe785 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/ConfigUpdateHelper.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/ConfigUpdateHelper.java @@ -1,5 +1,6 @@ package net.i2p.router.web; +import net.i2p.I2PAppContext; import net.i2p.crypto.TrustedUpdate; import net.i2p.data.DataHelper; import net.i2p.router.RouterContext; @@ -12,8 +13,14 @@ public class ConfigUpdateHelper extends HelperBase { } public String getNewsURL() { - String url = _context.getProperty(ConfigUpdateHandler.PROP_NEWS_URL); - if (url != null) + return getNewsURL(_context); + } + + /** hack to replace the old news location with the new one, even if they have saved + the update page at some point */ + public static String getNewsURL(I2PAppContext ctx) { + String url = ctx.getProperty(ConfigUpdateHandler.PROP_NEWS_URL); + if (url != null && !url.equals(ConfigUpdateHandler.OLD_DEFAULT_NEWS_URL)) return url; else return ConfigUpdateHandler.DEFAULT_NEWS_URL; @@ -26,18 +33,10 @@ public class ConfigUpdateHelper extends HelperBase { return ConfigUpdateHandler.DEFAULT_UPDATE_URL; } public String getProxyHost() { - String host = _context.getProperty(ConfigUpdateHandler.PROP_PROXY_HOST); - if (host != null) - return host; - else - return ConfigUpdateHandler.DEFAULT_PROXY_HOST; + return _context.getProperty(ConfigUpdateHandler.PROP_PROXY_HOST, ConfigUpdateHandler.DEFAULT_PROXY_HOST); } public String getProxyPort() { - String port = _context.getProperty(ConfigUpdateHandler.PROP_PROXY_PORT); - if (port != null) - return port; - else - return ConfigUpdateHandler.DEFAULT_PROXY_PORT; + return _context.getProperty(ConfigUpdateHandler.PROP_PROXY_PORT, ConfigUpdateHandler.DEFAULT_PROXY_PORT); } public String getUpdateThroughProxy() { @@ -76,8 +75,7 @@ public class ConfigUpdateHelper extends HelperBase { } public String getUpdatePolicySelectBox() { - String policy = _context.getProperty(ConfigUpdateHandler.PROP_UPDATE_POLICY); - if (policy == null) policy = ConfigUpdateHandler.DEFAULT_UPDATE_POLICY; + String policy = _context.getProperty(ConfigUpdateHandler.PROP_UPDATE_POLICY, ConfigUpdateHandler.DEFAULT_UPDATE_POLICY); StringBuffer buf = new StringBuffer(256); buf.append("<select name=\"updatePolicy\">"); diff --git a/apps/routerconsole/java/src/net/i2p/router/web/NewsFetcher.java b/apps/routerconsole/java/src/net/i2p/router/web/NewsFetcher.java index 98fac325d191b9b73e9d1261b980c39affbdadb9..0eeaca32bfd5513795581da90c1d8316d88b97a1 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/NewsFetcher.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/NewsFetcher.java @@ -110,7 +110,7 @@ public class NewsFetcher implements Runnable, EepGet.StatusListener { } } public void fetchNews() { - String newsURL = _context.getProperty(ConfigUpdateHandler.PROP_NEWS_URL, ConfigUpdateHandler.DEFAULT_NEWS_URL); + String newsURL = ConfigUpdateHelper.getNewsURL(_context); boolean shouldProxy = Boolean.valueOf(_context.getProperty(ConfigUpdateHandler.PROP_SHOULD_PROXY, ConfigUpdateHandler.DEFAULT_SHOULD_PROXY)).booleanValue(); String proxyHost = _context.getProperty(ConfigUpdateHandler.PROP_PROXY_HOST, ConfigUpdateHandler.DEFAULT_PROXY_HOST); String port = _context.getProperty(ConfigUpdateHandler.PROP_PROXY_PORT, ConfigUpdateHandler.DEFAULT_PROXY_PORT);