forked from I2P_Developers/i2p.i2p
propagate from branch 'i2p.i2p.zzz.jetty8' (head 0a03ce60906c508b08cc84b3044954844a6ee157)
to branch 'i2p.i2p' (head d99392e09883a92b99a316b4deed0586dcf4ea5b)
This commit is contained in:
@ -17,12 +17,16 @@ import java.util.StringTokenizer;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import net.i2p.I2PAppContext;
|
||||
import net.i2p.app.ClientAppManager;
|
||||
import net.i2p.app.ClientAppState;
|
||||
import static net.i2p.app.ClientAppState.*;
|
||||
import net.i2p.crypto.SU3File;
|
||||
import net.i2p.crypto.TrustedUpdate;
|
||||
import net.i2p.data.DataHelper;
|
||||
import net.i2p.router.Router;
|
||||
import net.i2p.router.RouterContext;
|
||||
import net.i2p.router.RouterVersion;
|
||||
import net.i2p.router.app.RouterApp;
|
||||
import net.i2p.router.web.ConfigServiceHandler;
|
||||
import net.i2p.router.web.ConfigUpdateHandler;
|
||||
import net.i2p.router.web.Messages;
|
||||
@ -50,7 +54,7 @@ import net.i2p.util.VersionComparator;
|
||||
*
|
||||
* @since 0.9.4
|
||||
*/
|
||||
public class ConsoleUpdateManager implements UpdateManager {
|
||||
public class ConsoleUpdateManager implements UpdateManager, RouterApp {
|
||||
|
||||
private final RouterContext _context;
|
||||
private final Log _log;
|
||||
@ -68,6 +72,8 @@ public class ConsoleUpdateManager implements UpdateManager {
|
||||
private final Map<UpdateItem, Version> _installed;
|
||||
private final boolean _allowTorrent;
|
||||
private static final DecimalFormat _pct = new DecimalFormat("0.0%");
|
||||
private final ClientAppManager _cmgr;
|
||||
private volatile ClientAppState _state = UNINITIALIZED;
|
||||
|
||||
private volatile String _status;
|
||||
|
||||
@ -77,8 +83,12 @@ public class ConsoleUpdateManager implements UpdateManager {
|
||||
private static final long TASK_CLEANER_TIME = 15*60*1000;
|
||||
private static final String PROP_UNSIGNED_AVAILABLE = "router.updateUnsignedAvailable";
|
||||
|
||||
public ConsoleUpdateManager(RouterContext ctx) {
|
||||
/**
|
||||
* @param args ignored
|
||||
*/
|
||||
public ConsoleUpdateManager(RouterContext ctx, ClientAppManager listener, String[] args) {
|
||||
_context = ctx;
|
||||
_cmgr = listener;
|
||||
_log = ctx.logManager().getLog(ConsoleUpdateManager.class);
|
||||
_registeredUpdaters = new ConcurrentHashSet<RegisteredUpdater>();
|
||||
_registeredCheckers = new ConcurrentHashSet<RegisteredChecker>();
|
||||
@ -98,13 +108,34 @@ public class ConsoleUpdateManager implements UpdateManager {
|
||||
//_allowTorrent = RouterVersion.BUILD != 0 || _context.random().nextInt(100) < 60;
|
||||
// Finally, for 0.9.12, 18 months later...
|
||||
_allowTorrent = true;
|
||||
_state = INITIALIZED;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null if not found
|
||||
*/
|
||||
public static ConsoleUpdateManager getInstance() {
|
||||
return (ConsoleUpdateManager) I2PAppContext.getGlobalContext().updateManager();
|
||||
ClientAppManager cmgr = I2PAppContext.getGlobalContext().clientAppManager();
|
||||
if (cmgr == null)
|
||||
return null;
|
||||
return (ConsoleUpdateManager) cmgr.getRegisteredApp(APP_NAME);
|
||||
}
|
||||
|
||||
/////// ClientApp methods
|
||||
|
||||
/**
|
||||
* UpdateManager interface
|
||||
*/
|
||||
public void start() {
|
||||
startup();
|
||||
}
|
||||
|
||||
/**
|
||||
* ClientApp interface
|
||||
* @since 0.9.12
|
||||
*/
|
||||
public synchronized void startup() {
|
||||
changeState(STARTING);
|
||||
notifyInstalled(NEWS, "", Long.toString(NewsHelper.lastUpdated(_context)));
|
||||
notifyInstalled(ROUTER_SIGNED, "", RouterVersion.VERSION);
|
||||
notifyInstalled(ROUTER_SIGNED_SU3, "", RouterVersion.VERSION);
|
||||
@ -118,7 +149,6 @@ public class ConsoleUpdateManager implements UpdateManager {
|
||||
notifyInstalled(PLUGIN, plugin, ver);
|
||||
}
|
||||
|
||||
_context.registerUpdateManager(this);
|
||||
DummyHandler dh = new DummyHandler(_context, this);
|
||||
register((Checker)dh, TYPE_DUMMY, METHOD_DUMMY, 0);
|
||||
register((Updater)dh, TYPE_DUMMY, METHOD_DUMMY, 0);
|
||||
@ -162,10 +192,27 @@ public class ConsoleUpdateManager implements UpdateManager {
|
||||
//register((Updater)puh, PLUGIN, FILE, 0);
|
||||
new NewsTimerTask(_context, this);
|
||||
_context.simpleScheduler().addPeriodicEvent(new TaskCleaner(), TASK_CLEANER_TIME);
|
||||
changeState(RUNNING);
|
||||
if (_cmgr != null)
|
||||
_cmgr.register(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* UpdateManager interface
|
||||
*/
|
||||
public void shutdown() {
|
||||
_context.unregisterUpdateManager(this);
|
||||
shutdown(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* ClientApp interface
|
||||
* @param args ignored
|
||||
* @since 0.9.12
|
||||
*/
|
||||
public synchronized void shutdown(String[] args) {
|
||||
if (_state == STOPPED)
|
||||
return;
|
||||
changeState(STOPPING);
|
||||
stopChecks();
|
||||
stopUpdates();
|
||||
_registeredUpdaters.clear();
|
||||
@ -173,6 +220,30 @@ public class ConsoleUpdateManager implements UpdateManager {
|
||||
_available.clear();
|
||||
_downloaded.clear();
|
||||
_installed.clear();
|
||||
changeState(STOPPED);
|
||||
}
|
||||
|
||||
/** @since 0.9.12 */
|
||||
public ClientAppState getState() {
|
||||
return _state;
|
||||
}
|
||||
|
||||
/** @since 0.9.12 */
|
||||
public String getName() {
|
||||
return APP_NAME;
|
||||
}
|
||||
|
||||
/** @since 0.9.12 */
|
||||
public String getDisplayName() {
|
||||
return "Console Update Manager";
|
||||
}
|
||||
|
||||
/////// end ClientApp methods
|
||||
|
||||
private synchronized void changeState(ClientAppState state) {
|
||||
_state = state;
|
||||
if (_cmgr != null)
|
||||
_cmgr.notify(this, state, null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -21,8 +21,14 @@ import static net.i2p.update.UpdateMethod.*;
|
||||
*/
|
||||
class NewsHandler extends UpdateHandler implements Checker {
|
||||
|
||||
/** @since 0.7.14 not configurable */
|
||||
private static final String BACKUP_NEWS_URL = "http://www.i2p2.i2p/_static/news/news.xml";
|
||||
/**
|
||||
* Changed in 0.9.11 to the b32 for psi.i2p, run by psi.
|
||||
* We may be able to change it to psi.i2p in a future release after
|
||||
* the hostname propagates.
|
||||
*
|
||||
* @since 0.7.14 not configurable
|
||||
*/
|
||||
private static final String BACKUP_NEWS_URL = "http://avviiexdngd32ccoy4kuckvc3mkf53ycvzbz6vz75vzhv4tbpk5a.b32.i2p/news.xml";
|
||||
|
||||
public NewsHandler(RouterContext ctx, ConsoleUpdateManager mgr) {
|
||||
super(ctx, mgr);
|
||||
|
@ -370,7 +370,7 @@ public class ConfigClientsHandler extends FormHandler {
|
||||
* @param app null for a new install
|
||||
*/
|
||||
private void installPlugin(String app, String url) {
|
||||
ConsoleUpdateManager mgr = (ConsoleUpdateManager) _context.updateManager();
|
||||
ConsoleUpdateManager mgr = UpdateHandler.updateManager(_context);
|
||||
if (mgr == null) {
|
||||
addFormError("Update manager not registered, cannot install");
|
||||
return;
|
||||
@ -397,7 +397,7 @@ public class ConfigClientsHandler extends FormHandler {
|
||||
}
|
||||
|
||||
private void checkPlugin(String app) {
|
||||
ConsoleUpdateManager mgr = (ConsoleUpdateManager) _context.updateManager();
|
||||
ConsoleUpdateManager mgr = UpdateHandler.updateManager(_context);
|
||||
if (mgr == null) {
|
||||
addFormError("Update manager not registered, cannot check");
|
||||
return;
|
||||
|
@ -90,8 +90,11 @@ public class ConfigClientsHelper extends HelperBase {
|
||||
/** clients */
|
||||
public String getForm1() {
|
||||
StringBuilder buf = new StringBuilder(1024);
|
||||
buf.append("<table>\n");
|
||||
buf.append("<tr><th align=\"right\">" + _("Client") + "</th><th>" + _("Run at Startup?") + "</th><th>" + _("Control") + "</th><th align=\"left\">" + _("Class and arguments") + "</th></tr>\n");
|
||||
buf.append("<table>\n" +
|
||||
"<tr><th align=\"right\">").append(_("Client")).append("</th><th>")
|
||||
.append(_("Run at Startup?")).append("</th><th>")
|
||||
.append(_("Control")).append("</th><th align=\"left\">")
|
||||
.append(_("Class and arguments")).append("</th></tr>\n");
|
||||
|
||||
List<ClientAppConfig> clients = ClientAppConfig.getClientApps(_context);
|
||||
for (int cur = 0; cur < clients.size(); cur++) {
|
||||
@ -134,8 +137,11 @@ public class ConfigClientsHelper extends HelperBase {
|
||||
/** webapps */
|
||||
public String getForm2() {
|
||||
StringBuilder buf = new StringBuilder(1024);
|
||||
buf.append("<table>\n");
|
||||
buf.append("<tr><th align=\"right\">" + _("WebApp") + "</th><th>" + _("Run at Startup?") + "</th><th>" + _("Control") + "</th><th align=\"left\">" + _("Description") + "</th></tr>\n");
|
||||
buf.append("<table>\n" +
|
||||
"<tr><th align=\"right\">").append(_("WebApp")).append("</th><th>")
|
||||
.append(_("Run at Startup?")).append("</th><th>")
|
||||
.append(_("Control")).append("</th><th align=\"left\">")
|
||||
.append(_("Description")).append("</th></tr>\n");
|
||||
Properties props = RouterConsoleRunner.webAppProperties(_context);
|
||||
Set<String> keys = new TreeSet(props.keySet());
|
||||
for (String name : keys) {
|
||||
@ -159,8 +165,11 @@ public class ConfigClientsHelper extends HelperBase {
|
||||
/** plugins */
|
||||
public String getForm3() {
|
||||
StringBuilder buf = new StringBuilder(1024);
|
||||
buf.append("<table>\n");
|
||||
buf.append("<tr><th align=\"right\">" + _("Plugin") + "</th><th>" + _("Run at Startup?") + "</th><th>" + _("Control") + "</th><th align=\"left\">" + _("Description") + "</th></tr>\n");
|
||||
buf.append("<table>\n" +
|
||||
"<tr><th align=\"right\">").append(_("Plugin")).append("</th><th>")
|
||||
.append(_("Run at Startup?")).append("</th><th>")
|
||||
.append(_("Control")).append("</th><th align=\"left\">")
|
||||
.append(_("Description")).append("</th></tr>\n");
|
||||
Properties props = PluginStarter.pluginProperties();
|
||||
Set<String> keys = new TreeSet(props.keySet());
|
||||
for (String name : keys) {
|
||||
@ -273,15 +282,20 @@ public class ConfigClientsHelper extends HelperBase {
|
||||
// The icons were way too much, so there's an X in each button class,
|
||||
// remove if you wnat to put them back
|
||||
if (showStartButton && (!ro) && !edit) {
|
||||
buf.append("<button type=\"submit\" class=\"Xaccept\" name=\"action\" value=\"Start ").append(index).append("\" >" + _("Start") + "<span class=hide> ").append(index).append("</span></button>");
|
||||
buf.append("<button type=\"submit\" class=\"Xaccept\" name=\"action\" value=\"Start ").append(index).append("\" >")
|
||||
.append(_("Start")).append("<span class=hide> ").append(index).append("</span></button>");
|
||||
}
|
||||
if (showStopButton && (!edit))
|
||||
buf.append("<button type=\"submit\" class=\"Xstop\" name=\"action\" value=\"Stop ").append(index).append("\" >" + _("Stop") + "<span class=hide> ").append(index).append("</span></button>");
|
||||
buf.append("<button type=\"submit\" class=\"Xstop\" name=\"action\" value=\"Stop ").append(index).append("\" >")
|
||||
.append(_("Stop")).append("<span class=hide> ").append(index).append("</span></button>");
|
||||
if (showEditButton && (!edit) && !ro)
|
||||
buf.append("<button type=\"submit\" class=\"Xadd\" name=\"edit\" value=\"Edit ").append(index).append("\" >" + _("Edit") + "<span class=hide> ").append(index).append("</span></button>");
|
||||
buf.append("<button type=\"submit\" class=\"Xadd\" name=\"edit\" value=\"Edit ").append(index).append("\" >")
|
||||
.append(_("Edit")).append("<span class=hide> ").append(index).append("</span></button>");
|
||||
if (showUpdateButton && (!edit) && !ro) {
|
||||
buf.append("<button type=\"submit\" class=\"Xcheck\" name=\"action\" value=\"Check ").append(index).append("\" >" + _("Check for updates") + "<span class=hide> ").append(index).append("</span></button>");
|
||||
buf.append("<button type=\"submit\" class=\"Xdownload\" name=\"action\" value=\"Update ").append(index).append("\" >" + _("Update") + "<span class=hide> ").append(index).append("</span></button>");
|
||||
buf.append("<button type=\"submit\" class=\"Xcheck\" name=\"action\" value=\"Check ").append(index).append("\" >")
|
||||
.append(_("Check for updates")).append("<span class=hide> ").append(index).append("</span></button>");
|
||||
buf.append("<button type=\"submit\" class=\"Xdownload\" name=\"action\" value=\"Update ").append(index).append("\" >")
|
||||
.append(_("Update")).append("<span class=hide> ").append(index).append("</span></button>");
|
||||
}
|
||||
if (showDeleteButton && (!edit) && !ro) {
|
||||
buf.append("<button type=\"submit\" class=\"Xdelete\" name=\"action\" value=\"Delete ").append(index)
|
||||
|
@ -45,9 +45,9 @@ public class ConfigLoggingHelper extends HelperBase {
|
||||
buf.append(prefix).append('=').append(level).append('\n');
|
||||
}
|
||||
buf.append("</textarea><br>\n");
|
||||
buf.append("<i>" + _("Add additional logging statements above. Example: net.i2p.router.tunnel=WARN") + "</i><br>");
|
||||
buf.append("<i>" + _("Or put entries in the logger.config file. Example: logger.record.net.i2p.router.tunnel=WARN") + "</i><br>");
|
||||
buf.append("<i>" + _("Valid levels are DEBUG, INFO, WARN, ERROR, CRIT") + "</i>\n");
|
||||
buf.append("<i>").append(_("Add additional logging statements above. Example: net.i2p.router.tunnel=WARN")).append("</i><br>");
|
||||
buf.append("<i>").append(_("Or put entries in the logger.config file. Example: logger.record.net.i2p.router.tunnel=WARN")).append("</i><br>");
|
||||
buf.append("<i>").append(_("Valid levels are DEBUG, INFO, WARN, ERROR, CRIT")).append("</i>\n");
|
||||
|
||||
/****
|
||||
// this is too big and ugly
|
||||
|
@ -103,11 +103,33 @@ public class ConfigUIHelper extends HelperBase {
|
||||
|
||||
/** todo sort by translated string */
|
||||
public String getLangSettings() {
|
||||
StringBuilder buf = new StringBuilder(512);
|
||||
String current = Messages.getLanguage(_context);
|
||||
String clang = Messages.getLanguage(_context);
|
||||
String current = clang;
|
||||
String country = Messages.getCountry(_context);
|
||||
if (country != null && country.length() > 0)
|
||||
current += '_' + country;
|
||||
// find best match
|
||||
boolean found = false;
|
||||
for (int i = 0; i < langs.length; i++) {
|
||||
if (langs[i][0].equals(current)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
if (country != null && country.length() > 0) {
|
||||
current = clang;
|
||||
for (int i = 0; i < langs.length; i++) {
|
||||
if (langs[i][0].equals(current)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!found)
|
||||
current = "en";
|
||||
}
|
||||
StringBuilder buf = new StringBuilder(512);
|
||||
for (int i = 0; i < langs.length; i++) {
|
||||
// we use "lang" so it is set automagically in CSSHelper
|
||||
buf.append("<input type=\"radio\" class=\"optbox\" name=\"lang\" ");
|
||||
|
@ -67,7 +67,7 @@ public class ConfigUpdateHandler extends FormHandler {
|
||||
"http://inr.i2p/i2p/i2pupdate.su2\r\n" +
|
||||
"http://meeh.i2p/i2pupdate/i2pupdate.su2\r\n" +
|
||||
"http://stats.i2p/i2p/i2pupdate.su2\r\n" +
|
||||
"http://www.i2p2.i2p/_static/i2pupdate.su2\r\n" +
|
||||
// "http://www.i2p2.i2p/_static/i2pupdate.su2\r\n" +
|
||||
"http://update.dg.i2p/files/i2pupdate.su2\r\n" +
|
||||
"http://update.killyourtv.i2p/i2pupdate.su2\r\n" +
|
||||
"http://update.postman.i2p/i2pupdate.su2" ;
|
||||
@ -77,7 +77,7 @@ public class ConfigUpdateHandler extends FormHandler {
|
||||
"http://inr.i2p/i2p/i2pupdate.sud\r\n" +
|
||||
"http://meeh.i2p/i2pupdate/i2pupdate.sud\r\n" +
|
||||
"http://stats.i2p/i2p/i2pupdate.sud\r\n" +
|
||||
"http://www.i2p2.i2p/_static/i2pupdate.sud\r\n" +
|
||||
// "http://www.i2p2.i2p/_static/i2pupdate.sud\r\n" +
|
||||
"http://update.dg.i2p/files/i2pupdate.sud\r\n" +
|
||||
"http://update.killyourtv.i2p/i2pupdate.sud\r\n" +
|
||||
"http://update.postman.i2p/i2pupdate.sud" ;
|
||||
@ -111,7 +111,7 @@ public class ConfigUpdateHandler extends FormHandler {
|
||||
"http://inr.i2p/i2p/i2pupdate.su3\r\n" +
|
||||
"http://meeh.i2p/i2pupdate/i2pupdate.su3\r\n" +
|
||||
"http://stats.i2p/i2p/i2pupdate.su3\r\n" +
|
||||
"http://www.i2p2.i2p/_static/i2pupdate.su3\r\n" +
|
||||
// "http://www.i2p2.i2p/_static/i2pupdate.su3\r\n" +
|
||||
"http://update.dg.i2p/files/i2pupdate.su3\r\n" +
|
||||
"http://update.killyourtv.i2p/i2pupdate.su3\r\n" +
|
||||
"http://update.postman.i2p/i2pupdate.su3" ;
|
||||
@ -139,7 +139,7 @@ public class ConfigUpdateHandler extends FormHandler {
|
||||
if (_action == null)
|
||||
return;
|
||||
if (_action.equals(_("Check for updates"))) {
|
||||
ConsoleUpdateManager mgr = (ConsoleUpdateManager) _context.updateManager();
|
||||
ConsoleUpdateManager mgr = UpdateHandler.updateManager(_context);
|
||||
if (mgr == null) {
|
||||
addFormError("Update manager not registered, cannot check");
|
||||
return;
|
||||
|
@ -115,9 +115,9 @@ public class ConfigUpdateHelper extends HelperBase {
|
||||
buf.append("\" selected=\"selected");
|
||||
|
||||
if (PERIODS[i] == -1)
|
||||
buf.append("\">" + _("Never") + "</option>\n");
|
||||
buf.append("\">").append(_("Never")).append("</option>\n");
|
||||
else
|
||||
buf.append("\">" + _("Every") + " ").append(DataHelper.formatDuration2(PERIODS[i])).append("</option>\n");
|
||||
buf.append("\">").append(_("Every")).append(' ').append(DataHelper.formatDuration2(PERIODS[i])).append("</option>\n");
|
||||
}
|
||||
buf.append("</select>\n");
|
||||
return buf.toString();
|
||||
|
@ -351,7 +351,7 @@ public class GraphHelper extends FormHandler {
|
||||
try {
|
||||
_out.write("<br><h3>" + _("Configure Graph Display") + " [<a href=\"configstats\">" + _("Select Stats") + "</a>]</h3>");
|
||||
_out.write("<form action=\"graphs\" method=\"POST\">\n" +
|
||||
"<input type=\"hidden\" name=\"action\" value=\"foo\">\n" +
|
||||
"<input type=\"hidden\" name=\"action\" value=\"save\">\n" +
|
||||
"<input type=\"hidden\" name=\"nonce\" value=\"" + nonce + "\" >\n");
|
||||
_out.write(_("Periods") + ": <input size=\"5\" style=\"text-align: right;\" type=\"text\" name=\"periodCount\" value=\"" + _periodCount + "\"><br>\n");
|
||||
_out.write(_("Plot averages") + ": <input type=\"radio\" class=\"optbox\" name=\"showEvents\" value=\"false\" " + (_showEvents ? "" : "checked=\"checked\" ") + "> ");
|
||||
@ -380,7 +380,7 @@ public class GraphHelper extends FormHandler {
|
||||
if (persistent)
|
||||
_out.write(" checked=\"checked\"");
|
||||
_out.write(">" +
|
||||
"<hr><div class=\"formaction\"><input type=\"submit\" class=\"acceot\" value=\"" + _("Save settings and redraw graphs") + "\"></div></form>");
|
||||
"<hr><div class=\"formaction\"><input type=\"submit\" class=\"accept\" value=\"" + _("Save settings and redraw graphs") + "\"></div></form>");
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
}
|
||||
@ -413,7 +413,8 @@ public class GraphHelper extends FormHandler {
|
||||
*/
|
||||
@Override
|
||||
protected void processForm() {
|
||||
saveSettings();
|
||||
if ("save".equals(_action))
|
||||
saveSettings();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -23,6 +23,7 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import net.i2p.data.Base32;
|
||||
import net.i2p.data.DataHelper;
|
||||
import net.i2p.data.Destination;
|
||||
import net.i2p.data.Hash;
|
||||
@ -167,6 +168,8 @@ public class NetDbRenderer {
|
||||
median = dist;
|
||||
}
|
||||
buf.append(" Dist: <b>").append(fmt.format(biLog2(dist))).append("</b><br>");
|
||||
buf.append(Base32.encode(key.getData())).append(".b32.i2p<br>");
|
||||
buf.append("Sig type: ").append(dest.getSigningPublicKey().getType()).append("<br>");
|
||||
buf.append("Routing Key: ").append(ls.getRoutingKey().toBase64());
|
||||
buf.append("<br>");
|
||||
buf.append("Encryption Key: ").append(ls.getEncryptionKey().toBase64().substring(0, 20)).append("...<br>");
|
||||
|
@ -121,7 +121,7 @@ public class PluginStarter implements Runnable {
|
||||
if (toUpdate.isEmpty())
|
||||
return;
|
||||
|
||||
ConsoleUpdateManager mgr = (ConsoleUpdateManager) ctx.updateManager();
|
||||
ConsoleUpdateManager mgr = UpdateHandler.updateManager(ctx);
|
||||
if (mgr == null)
|
||||
return;
|
||||
if (mgr.isUpdateInProgress())
|
||||
|
@ -645,7 +645,7 @@ public class RouterConsoleRunner implements RouterApp {
|
||||
t.setPriority(Thread.NORM_PRIORITY - 1);
|
||||
t.start();
|
||||
|
||||
ConsoleUpdateManager um = new ConsoleUpdateManager(_context);
|
||||
ConsoleUpdateManager um = new ConsoleUpdateManager(_context, _mgr, null);
|
||||
um.start();
|
||||
|
||||
if (PluginStarter.pluginsEnabled(_context)) {
|
||||
|
@ -422,11 +422,11 @@ public class SummaryHelper extends HelperBase {
|
||||
|
||||
buf.append("<tr><td align=\"right\"><img src=\"/themes/console/images/");
|
||||
if (_context.clientManager().shouldPublishLeaseSet(h))
|
||||
buf.append("server.png\" alt=\"Server\" title=\"" + _("Server") + "\">");
|
||||
buf.append("server.png\" alt=\"Server\" title=\"").append(_("Server")).append("\">");
|
||||
else
|
||||
buf.append("client.png\" alt=\"Client\" title=\"" + _("Client") + "\">");
|
||||
buf.append("client.png\" alt=\"Client\" title=\"").append(_("Client")).append("\">");
|
||||
buf.append("</td><td align=\"left\"><b><a href=\"tunnels#").append(h.toBase64().substring(0,4));
|
||||
buf.append("\" target=\"_top\" title=\"" + _("Show tunnels") + "\">");
|
||||
buf.append("\" target=\"_top\" title=\"").append(_("Show tunnels")).append("\">");
|
||||
if (name.length() < 18)
|
||||
buf.append(name);
|
||||
else
|
||||
@ -861,7 +861,7 @@ public class SummaryHelper extends HelperBase {
|
||||
.append("\"></td><td align=\"left\">")
|
||||
.append(_(sectionNames.get(section)))
|
||||
.append("</td><td align=\"right\"><input type=\"hidden\" name=\"order_")
|
||||
.append(i + "_" + section)
|
||||
.append(i).append('_').append(section)
|
||||
.append("\" value=\"")
|
||||
.append(i)
|
||||
.append("\">");
|
||||
|
@ -78,8 +78,17 @@ class SummaryListener implements RateSummaryListener {
|
||||
//String names[] = _sample.getDsNames();
|
||||
//System.out.println("Add " + val + " over " + eventCount + " for " + _name
|
||||
// + " [" + names[0] + ", " + names[1] + "]");
|
||||
} catch (IllegalArgumentException iae) {
|
||||
// ticket #1186
|
||||
// apparently a corrupt file, thrown from update()
|
||||
_log.error("Error adding", iae);
|
||||
String path = _isPersistent ? _db.getPath() : null;
|
||||
stopListening();
|
||||
if (path != null)
|
||||
(new File(path)).delete();
|
||||
} catch (IOException ioe) {
|
||||
_log.error("Error adding", ioe);
|
||||
stopListening();
|
||||
} catch (RrdException re) {
|
||||
// this can happen after the time slews backwards, so don't make it an error
|
||||
// org.jrobin.core.RrdException: Bad sample timestamp 1264343107. Last update time was 1264343172, at least one second step is required
|
||||
|
@ -1,7 +1,9 @@
|
||||
package net.i2p.router.web;
|
||||
|
||||
import net.i2p.app.ClientAppManager;
|
||||
import net.i2p.router.RouterContext;
|
||||
import net.i2p.router.update.ConsoleUpdateManager;
|
||||
import net.i2p.update.UpdateManager;
|
||||
import net.i2p.update.UpdateType;
|
||||
import static net.i2p.update.UpdateType.*;
|
||||
import net.i2p.util.Log;
|
||||
@ -33,6 +35,17 @@ public class UpdateHandler {
|
||||
_context = ctx;
|
||||
_log = ctx.logManager().getLog(UpdateHandler.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null if not found
|
||||
* @since 0.9.12
|
||||
*/
|
||||
public static ConsoleUpdateManager updateManager(RouterContext ctx) {
|
||||
ClientAppManager cmgr = ctx.clientAppManager();
|
||||
if (cmgr == null)
|
||||
return null;
|
||||
return (ConsoleUpdateManager) cmgr.getRegisteredApp(UpdateManager.APP_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure this bean to query a particular router context
|
||||
@ -75,7 +88,7 @@ public class UpdateHandler {
|
||||
}
|
||||
|
||||
private void update(UpdateType type) {
|
||||
ConsoleUpdateManager mgr = (ConsoleUpdateManager) _context.updateManager();
|
||||
ConsoleUpdateManager mgr = updateManager(_context);
|
||||
if (mgr == null)
|
||||
return;
|
||||
if (mgr.isUpdateInProgress(ROUTER_SIGNED) || mgr.isUpdateInProgress(ROUTER_UNSIGNED) ||
|
||||
|
Reference in New Issue
Block a user