From c9db6f87d1f805a12cccfcb77a8b9c774d966764 Mon Sep 17 00:00:00 2001 From: smeghead Date: Tue, 26 Apr 2005 02:59:23 +0000 Subject: [PATCH] 2005-04-25 smeghead * Added button to router console for manual update checks. * Fixed bug in configupdate.jsp that caused the proxy port to be updated every time the form was submitted even if it hadn't changed. --- .../net/i2p/router/web/ConfigUpdateHandler.java | 16 +++++++++++++++- .../java/src/net/i2p/router/web/NewsFetcher.java | 2 +- apps/routerconsole/jsp/configupdate.jsp | 8 ++++---- history.txt | 7 ++++++- 4 files changed, 26 insertions(+), 7 deletions(-) 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 e75f6e0b6..f059dc94e 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/ConfigUpdateHandler.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/ConfigUpdateHandler.java @@ -1,6 +1,10 @@ package net.i2p.router.web; +import net.i2p.I2PAppContext; import net.i2p.data.DataHelper; +import net.i2p.router.Router; +import net.i2p.router.web.ConfigServiceHandler.UpdateWrapperManagerTask; +import net.i2p.util.Log; /** * @@ -31,6 +35,15 @@ public class ConfigUpdateHandler extends FormHandler { public static final String DEFAULT_PROXY_PORT = "4444"; protected void processForm() { + if ("Check for update now".equals(_action)) { + NewsFetcher fetcher = NewsFetcher.getInstance(I2PAppContext.getGlobalContext()); + fetcher.fetchNews(); + if (fetcher.updateAvailable()) + addFormNotice("Update available, click link on left"); + else + addFormNotice("No update available"); + } + if ( (_newsURL != null) && (_newsURL.length() > 0) ) { String oldURL = _context.router().getConfigSetting(PROP_NEWS_URL); if ( (oldURL == null) || (!_newsURL.equals(oldURL)) ) { @@ -38,6 +51,7 @@ public class ConfigUpdateHandler extends FormHandler { addFormNotice("Updating news URL to " + _newsURL); } } + if ( (_updateURL != null) && (_updateURL.length() > 0) ) { String oldURL = _context.router().getConfigSetting(PROP_UPDATE_URL); if ( (oldURL == null) || (!_updateURL.equals(oldURL)) ) { @@ -56,7 +70,7 @@ public class ConfigUpdateHandler extends FormHandler { if ( (_proxyPort != null) && (_proxyPort.length() > 0) ) { String oldPort = _context.router().getConfigSetting(PROP_PROXY_PORT); - if ( (oldPort == null) || (!_proxyHost.equals(oldPort)) ) { + if ( (oldPort == null) || (!_proxyPort.equals(oldPort)) ) { _context.router().setConfigSetting(PROP_PROXY_PORT, _proxyPort); addFormNotice("Updating proxy port to " + _proxyPort); } 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 0299156a2..0d015f824 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/NewsFetcher.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/NewsFetcher.java @@ -91,7 +91,7 @@ public class NewsFetcher implements Runnable, EepGet.StatusListener { return false; } } - private void fetchNews() { + public void fetchNews() { String newsURL = _context.getProperty(ConfigUpdateHandler.PROP_NEWS_URL, ConfigUpdateHandler.DEFAULT_NEWS_URL); 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); diff --git a/apps/routerconsole/jsp/configupdate.jsp b/apps/routerconsole/jsp/configupdate.jsp index f1429d739..76b3aff0b 100644 --- a/apps/routerconsole/jsp/configupdate.jsp +++ b/apps/routerconsole/jsp/configupdate.jsp @@ -27,7 +27,7 @@ if (prev != null) System.setProperty("net.i2p.router.web.ConfigUpdateHandler.noncePrev", prev); System.setProperty("net.i2p.router.web.ConfigUpdateHandler.nonce", new java.util.Random().nextLong()+""); %> " /> - +

News URL: ">
Refresh frequency: @@ -36,10 +36,10 @@ ">
Update policy:
- Update anonymously? +Update through the eepProxy?
- Proxy host: " />
- Proxy port: " />
+ eepProxy host: " />
+ eepProxy port: " />
Trusted keys: diff --git a/history.txt b/history.txt index 56a52be88..476f8c0c2 100644 --- a/history.txt +++ b/history.txt @@ -1,4 +1,9 @@ -$Id: history.txt,v 1.197 2005/04/20 15:14:17 jrandom Exp $ +$Id: history.txt,v 1.198 2005/04/24 13:42:05 jrandom Exp $ + +2005-04-25 smeghead + * Added button to router console for manual update checks. + * Fixed bug in configupdate.jsp that caused the proxy port to be updated + every time the form was submitted even if it hadn't changed. 2005-04-24 jrandom * Added a pool of PRNGs using a different synchronization technique,