package net.i2p.router.update; import java.io.File; import java.net.URI; import java.net.URISyntaxException; import java.util.Collections; import java.util.List; import net.i2p.router.Router; import net.i2p.router.RouterContext; import net.i2p.router.util.RFC822Date; import net.i2p.router.web.ConfigUpdateHandler; import net.i2p.router.web.NewsHelper; import net.i2p.update.*; import static net.i2p.update.UpdateType.*; import static net.i2p.update.UpdateMethod.*; import net.i2p.util.EepGet; import net.i2p.util.FileUtil; import net.i2p.util.I2PAppThread; import net.i2p.util.Log; /** *
Handles the request to update the router by firing off an * {@link net.i2p.util.EepGet} call to download the latest unsigned zip file * and displaying the status to anyone who asks. *
*After the download completes the signed update file is copied to the * router directory, and if configured the router is restarted to complete * the update process. *
*/ class UnsignedUpdateHandler implements Checker, Updater { private final RouterContext _context; public UnsignedUpdateHandler(RouterContext ctx) { _context = ctx; } /** * @param currentVersion ignored, we use time stored in a property */ @Override public UpdateTask check(UpdateType type, UpdateMethod method, String id, String currentVersion, long maxTime) { if (type != UpdateType.ROUTER_UNSIGNED || method != UpdateMethod.HTTP) return null; String url = _context.getProperty(ConfigUpdateHandler.PROP_ZIP_URL); if (url == null) return null; List