forked from I2P_Developers/i2p.i2p
2005-03-23 jrandom
* New /configupdate.jsp page for controlling the update / notification
process, as well as various minor related updates. Note that not all
options are exposed yet, and the update detection code isn't in place
in this commit - it currently says there is always an update available.
* New EepGet component for reliable downloading, with a CLI exposed in
java -cp lib/i2p.jar net.i2p.util.EepGet url
* Added a default signing key to the TrustedUpdate component to be used
for verifying updates. This signing key can be authenticated via
gpg --verify i2p/core/java/src/net/i2p/crypto/TrustedUpdate.java
* New public domain SHA1 implementation for the DSA code so that we can
handle signing streams of arbitrary size without excess memory usage
(thanks P.Verdy!)
* Added some helpers to the TrustedUpdate to work off streams and to offer
a minimal CLI:
TrustedUpdate keygen pubKeyFile privKeyFile
TrustedUpdate sign origFile signedFile privKeyFile
TrustedUpdate verify signedFile
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
package net.i2p.router.web;
|
||||
|
||||
import java.util.List;
|
||||
import net.i2p.crypto.TrustedUpdate;
|
||||
import net.i2p.router.RouterContext;
|
||||
|
||||
public class ConfigUpdateHelper {
|
||||
private RouterContext _context;
|
||||
/**
|
||||
* Configure this bean to query a particular router context
|
||||
*
|
||||
* @param contextId begging few characters of the routerHash, or null to pick
|
||||
* the first one we come across.
|
||||
*/
|
||||
public void setContextId(String contextId) {
|
||||
try {
|
||||
_context = ContextHelper.getContext(contextId);
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public ConfigUpdateHelper() {}
|
||||
|
||||
public boolean updateAvailable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public String getNewsURL() {
|
||||
String url = _context.getProperty(ConfigUpdateHandler.PROP_NEWS_URL);
|
||||
if (url != null)
|
||||
return url;
|
||||
else
|
||||
return ConfigUpdateHandler.DEFAULT_NEWS_URL;
|
||||
}
|
||||
public String getUpdateURL() {
|
||||
String url = _context.getProperty(ConfigUpdateHandler.PROP_UPDATE_URL);
|
||||
if (url != null)
|
||||
return url;
|
||||
else
|
||||
return ConfigUpdateHandler.DEFAULT_UPDATE_URL;
|
||||
}
|
||||
|
||||
public String getUpdateThroughProxy() {
|
||||
String proxy = _context.getProperty(ConfigUpdateHandler.PROP_SHOULD_PROXY, ConfigUpdateHandler.DEFAULT_SHOULD_PROXY);
|
||||
if (Boolean.valueOf(proxy).booleanValue())
|
||||
return "<input type=\"checkbox\" value=\"true\" name=\"updateThroughProxy\" checked=\"true\" >";
|
||||
else
|
||||
|
||||
return "<input type=\"checkbox\" value=\"true\" name=\"updateThroughProxy\" >";
|
||||
}
|
||||
|
||||
public String getRefreshFrequencySelectBox() {
|
||||
return "<select name=\"refreshFrequency\">" +
|
||||
"<option value=\"" + (12*60*60*1000) + "\">Twice daily</option>" +
|
||||
"<option value=\"" + (24*60*60*1000) + "\" selected=\"true\" >Daily</option>" +
|
||||
"<option value=\"" + (48*60*60*1000) + "\">Every two days</option>" +
|
||||
"<option value=\"" + -1 + "\">Never</option>" +
|
||||
"</select>";
|
||||
}
|
||||
public String getUpdatePolicySelectBox() {
|
||||
return "<select name=\"updatePolicy\">" +
|
||||
"<option value=\"notify\">Notify only</option>" +
|
||||
"<option value=\"download\">Download but don't install</option>" +
|
||||
"<option value=\"install\">Install</option>" +
|
||||
"</select>";
|
||||
}
|
||||
public String getTrustedKeys() {
|
||||
StringBuffer buf = new StringBuffer(1024);
|
||||
TrustedUpdate up = new TrustedUpdate(_context);
|
||||
List keys = up.getTrustedKeys();
|
||||
for (int i = 0; i < keys.size(); i++)
|
||||
buf.append((String)keys.get(i)).append('\n');
|
||||
return buf.toString();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user