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.
This commit is contained in:
smeghead
2005-04-26 02:59:23 +00:00
committed by zzz
parent 567ce84e1e
commit c9db6f87d1
4 changed files with 26 additions and 7 deletions

View File

@ -1,6 +1,10 @@
package net.i2p.router.web; package net.i2p.router.web;
import net.i2p.I2PAppContext;
import net.i2p.data.DataHelper; 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"; public static final String DEFAULT_PROXY_PORT = "4444";
protected void processForm() { 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) ) { if ( (_newsURL != null) && (_newsURL.length() > 0) ) {
String oldURL = _context.router().getConfigSetting(PROP_NEWS_URL); String oldURL = _context.router().getConfigSetting(PROP_NEWS_URL);
if ( (oldURL == null) || (!_newsURL.equals(oldURL)) ) { if ( (oldURL == null) || (!_newsURL.equals(oldURL)) ) {
@ -38,6 +51,7 @@ public class ConfigUpdateHandler extends FormHandler {
addFormNotice("Updating news URL to " + _newsURL); addFormNotice("Updating news URL to " + _newsURL);
} }
} }
if ( (_updateURL != null) && (_updateURL.length() > 0) ) { if ( (_updateURL != null) && (_updateURL.length() > 0) ) {
String oldURL = _context.router().getConfigSetting(PROP_UPDATE_URL); String oldURL = _context.router().getConfigSetting(PROP_UPDATE_URL);
if ( (oldURL == null) || (!_updateURL.equals(oldURL)) ) { if ( (oldURL == null) || (!_updateURL.equals(oldURL)) ) {
@ -56,7 +70,7 @@ public class ConfigUpdateHandler extends FormHandler {
if ( (_proxyPort != null) && (_proxyPort.length() > 0) ) { if ( (_proxyPort != null) && (_proxyPort.length() > 0) ) {
String oldPort = _context.router().getConfigSetting(PROP_PROXY_PORT); 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); _context.router().setConfigSetting(PROP_PROXY_PORT, _proxyPort);
addFormNotice("Updating proxy port to " + _proxyPort); addFormNotice("Updating proxy port to " + _proxyPort);
} }

View File

@ -91,7 +91,7 @@ public class NewsFetcher implements Runnable, EepGet.StatusListener {
return false; return false;
} }
} }
private void fetchNews() { public void fetchNews() {
String newsURL = _context.getProperty(ConfigUpdateHandler.PROP_NEWS_URL, ConfigUpdateHandler.DEFAULT_NEWS_URL); 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(); 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 proxyHost = _context.getProperty(ConfigUpdateHandler.PROP_PROXY_HOST, ConfigUpdateHandler.DEFAULT_PROXY_HOST);

View File

@ -27,7 +27,7 @@
if (prev != null) System.setProperty("net.i2p.router.web.ConfigUpdateHandler.noncePrev", prev); 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()+""); %> System.setProperty("net.i2p.router.web.ConfigUpdateHandler.nonce", new java.util.Random().nextLong()+""); %>
<input type="hidden" name="nonce" value="<%=System.getProperty("net.i2p.router.web.ConfigUpdateHandler.nonce")%>" /> <input type="hidden" name="nonce" value="<%=System.getProperty("net.i2p.router.web.ConfigUpdateHandler.nonce")%>" />
<input type="hidden" name="action" value="update" /> <input type="submit" name="action" value="Check for update now" /><br /><br />
News URL: News URL:
<input type="text" size="60" name="newsURL" value="<jsp:getProperty name="updatehelper" property="newsURL" />"><br /> <input type="text" size="60" name="newsURL" value="<jsp:getProperty name="updatehelper" property="newsURL" />"><br />
Refresh frequency: Refresh frequency:
@ -36,10 +36,10 @@
<input type="text" size="60" name="updateURL" value="<jsp:getProperty name="updatehelper" property="updateURL" />"><br /> <input type="text" size="60" name="updateURL" value="<jsp:getProperty name="updatehelper" property="updateURL" />"><br />
Update policy: Update policy:
<jsp:getProperty name="updatehelper" property="updatePolicySelectBox" /><br /> <jsp:getProperty name="updatehelper" property="updatePolicySelectBox" /><br />
Update anonymously? Update through the eepProxy?
<jsp:getProperty name="updatehelper" property="updateThroughProxy" /><br /> <jsp:getProperty name="updatehelper" property="updateThroughProxy" /><br />
Proxy host: <input type="text" size="10" name="proxyHost" value="<jsp:getProperty name="updatehelper" property="proxyHost" />" /><br /> eepProxy host: <input type="text" size="10" name="proxyHost" value="<jsp:getProperty name="updatehelper" property="proxyHost" />" /><br />
Proxy port: <input type="text" size="4" name="proxyPort" value="<jsp:getProperty name="updatehelper" property="proxyPort" />" /><br /> eepProxy port: <input type="text" size="4" name="proxyPort" value="<jsp:getProperty name="updatehelper" property="proxyPort" />" /><br />
<!-- prompt for the eepproxy --> <!-- prompt for the eepproxy -->
Trusted keys: Trusted keys:
<textarea name="trustedKeys" disabled="true" cols="60" rows="2"><jsp:getProperty name="updatehelper" property="trustedKeys" /></textarea> <textarea name="trustedKeys" disabled="true" cols="60" rows="2"><jsp:getProperty name="updatehelper" property="trustedKeys" /></textarea>

View File

@ -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 2005-04-24 jrandom
* Added a pool of PRNGs using a different synchronization technique, * Added a pool of PRNGs using a different synchronization technique,