forked from I2P_Developers/i2p.i2p
- Fix DummyHandler
- Notes on news.xml enhancements - Fix handling existing torrent - Add dn to magnet link generation - Fix progress info
This commit is contained in:
@ -111,8 +111,10 @@ public class ConsoleUpdateManager implements UpdateManager {
|
||||
|
||||
_context.registerUpdateManager(this);
|
||||
DummyHandler dh = new DummyHandler(_context, this);
|
||||
register((Checker)dh, TYPE_DUMMY, HTTP, 0);
|
||||
register((Updater)dh, TYPE_DUMMY, HTTP, 0);
|
||||
register((Checker)dh, TYPE_DUMMY, METHOD_DUMMY, 0);
|
||||
register((Updater)dh, TYPE_DUMMY, METHOD_DUMMY, 0);
|
||||
VersionAvailable dummyVA = new VersionAvailable("", "", METHOD_DUMMY, Collections.EMPTY_LIST);
|
||||
_available.put(new UpdateItem(TYPE_DUMMY, ""), dummyVA);
|
||||
// register news before router, so we don't fire off an update
|
||||
// right at instantiation if the news is already indicating a new version
|
||||
Checker c = new NewsHandler(_context, this);
|
||||
@ -120,6 +122,9 @@ public class ConsoleUpdateManager implements UpdateManager {
|
||||
register(c, ROUTER_SIGNED, HTTP, 0); // news is an update checker for the router
|
||||
Updater u = new UpdateHandler(_context, this);
|
||||
register(u, ROUTER_SIGNED, HTTP, 0);
|
||||
// TODO see NewsFetcher
|
||||
//register(u, ROUTER_SIGNED, HTTPS_CLEARNET, -5);
|
||||
//register(u, ROUTER_SIGNED, HTTP_CLEARNET, -10);
|
||||
UnsignedUpdateHandler uuh = new UnsignedUpdateHandler(_context, this);
|
||||
register((Checker)uuh, ROUTER_UNSIGNED, HTTP, 0);
|
||||
register((Updater)uuh, ROUTER_UNSIGNED, HTTP, 0);
|
||||
@ -735,6 +740,7 @@ public class ConsoleUpdateManager implements UpdateManager {
|
||||
|
||||
/**
|
||||
* Not necessarily the end if there are more URIs to try.
|
||||
* @param task checker or updater
|
||||
* @param t may be null
|
||||
*/
|
||||
public void notifyAttemptFailed(UpdateTask task, String reason, Throwable t) {
|
||||
@ -744,6 +750,7 @@ public class ConsoleUpdateManager implements UpdateManager {
|
||||
|
||||
/**
|
||||
* The task has finished and failed.
|
||||
* @param task checker or updater
|
||||
* @param t may be null
|
||||
*/
|
||||
public void notifyTaskFailed(UpdateTask task, String reason, Throwable t) {
|
||||
@ -763,8 +770,9 @@ public class ConsoleUpdateManager implements UpdateManager {
|
||||
}
|
||||
_downloaders.remove(task);
|
||||
_activeCheckers.remove(task);
|
||||
///// for certain types only
|
||||
finishStatus("<b>" + _("Transfer failed from {0}", linkify(task.getURI().toString())) + "</b>");
|
||||
// any other types that shouldn't display?
|
||||
if (task.getURI() != null && task.getType() != TYPE_DUMMY)
|
||||
finishStatus("<b>" + _("Transfer failed from {0}", linkify(task.getURI().toString())) + "</b>");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -775,7 +783,7 @@ public class ConsoleUpdateManager implements UpdateManager {
|
||||
* If the return value is false, caller must call notifyTaskFailed() or notifyComplete()
|
||||
* again.
|
||||
*
|
||||
* @param must be an Updater, not a Checker
|
||||
* @param task must be an Updater, not a Checker
|
||||
* @param actualVersion may be higher (or lower?) than the version requested
|
||||
* @param file a valid format for the task's UpdateType, or null if it did the installation itself
|
||||
* @return true if valid, false if corrupt
|
||||
|
@ -55,6 +55,9 @@ class DummyHandler implements Checker, Updater {
|
||||
@Override
|
||||
public UpdateType getType() { return UpdateType.TYPE_DUMMY; }
|
||||
|
||||
@Override
|
||||
public UpdateMethod getMethod() { return UpdateMethod.METHOD_DUMMY; }
|
||||
|
||||
@Override
|
||||
protected void update() {
|
||||
try {
|
||||
|
@ -114,14 +114,23 @@ class NewsFetcher extends UpdateRunner {
|
||||
}
|
||||
}
|
||||
|
||||
// Fake XML parsing
|
||||
// Line must contain this, and full entry must be on one line
|
||||
private static final String VERSION_PREFIX = "<i2p.release ";
|
||||
// all keys mapped to lower case by parseArgs()
|
||||
private static final String VERSION_KEY = "version";
|
||||
private static final String SUD_KEY = "sudmagnet";
|
||||
private static final String SU2_KEY = "su2magnet";
|
||||
private static final String MIN_VERSION_KEY = "minversion";
|
||||
private static final String SUD_KEY = "sudtorrent";
|
||||
private static final String SU2_KEY = "su2torrent";
|
||||
private static final String CLEARNET_SUD_KEY = "sudclearnet";
|
||||
private static final String CLEARNET_SU2_KEY = "su2clearnet";
|
||||
private static final String I2P_SUD_KEY = "sudi2p";
|
||||
private static final String I2P_SU2_KEY = "su2i2p";
|
||||
|
||||
/**
|
||||
* Parse the installed (not the temp) news file for the latest version.
|
||||
* TODO: Real XML parsing
|
||||
* TODO: Check minVersion, use backup URLs specified
|
||||
*/
|
||||
void checkForUpdates() {
|
||||
FileInputStream in = null;
|
||||
@ -139,6 +148,9 @@ class NewsFetcher extends UpdateRunner {
|
||||
if (TrustedUpdate.needsUpdate(RouterVersion.VERSION, ver)) {
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("Our version is out of date, update!");
|
||||
// TODO if minversion > our version, continue
|
||||
// and look for a second entry with clearnet URLs
|
||||
// TODO clearnet URLs, notify with HTTP_CLEARNET and/or HTTPS_CLEARNET
|
||||
_mgr.notifyVersionAvailable(this, _currentURI,
|
||||
ROUTER_SIGNED, "", HTTP,
|
||||
_mgr.getUpdateURLs(ROUTER_SIGNED, "", HTTP),
|
||||
|
Reference in New Issue
Block a user