forked from I2P_Developers/i2p.i2p
* News Fetcher:
- Change default news URL, use it instead of the old one even if the old one is saved in the configuration, to assist in the transition
This commit is contained in:
@ -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);
|
||||
|
@ -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\">");
|
||||
|
@ -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);
|
||||
|
Reference in New Issue
Block a user