forked from I2P_Developers/i2p.i2p
merge of 'd09201283ea0356bf5b1d3aedc4795a202414930'
and 'e2f50f8cb50f8593ca882e94cb661c54b87d2468'
This commit is contained in:
@ -53,6 +53,8 @@ class UnsignedUpdateRunner extends UpdateRunner {
|
||||
} catch (Throwable t) {
|
||||
_log.error("Error updating", t);
|
||||
}
|
||||
if (!this.done)
|
||||
_mgr.notifyTaskFailed(this, "", null);
|
||||
}
|
||||
|
||||
/** eepget listener callback Overrides */
|
||||
|
@ -3,6 +3,8 @@ package net.i2p.router.web;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import net.i2p.util.RandomSource;
|
||||
|
||||
/**
|
||||
* Copied and modded from I2PTunnel IndexBean (GPL)
|
||||
* @author zzz
|
||||
@ -11,8 +13,6 @@ public class CSSHelper extends HelperBase {
|
||||
|
||||
private static final Map<String, Boolean> _UACache = new ConcurrentHashMap();
|
||||
|
||||
public CSSHelper() {}
|
||||
|
||||
public static final String PROP_UNIVERSAL_THEMING = "routerconsole.universal.theme";
|
||||
public static final String PROP_THEME_NAME = "routerconsole.theme";
|
||||
public static final String DEFAULT_THEME = "light";
|
||||
@ -24,6 +24,16 @@ public class CSSHelper extends HelperBase {
|
||||
public static final String PROP_DISABLE_REFRESH = "routerconsole.summaryDisableRefresh";
|
||||
private static final String PROP_XFRAME = "routerconsole.disableXFrame";
|
||||
|
||||
private static final String _consoleNonce = Long.toString(RandomSource.getInstance().nextLong());
|
||||
|
||||
/**
|
||||
* formerly stored in System.getProperty("router.consoleNonce")
|
||||
* @since 0.9.4
|
||||
*/
|
||||
public static String getNonce() {
|
||||
return _consoleNonce;
|
||||
}
|
||||
|
||||
public String getTheme(String userAgent) {
|
||||
String url = BASE_THEME_PATH;
|
||||
if (userAgent != null && userAgent.contains("MSIE")) {
|
||||
|
@ -3,6 +3,7 @@ package net.i2p.router.web;
|
||||
import net.i2p.data.DataHelper;
|
||||
import net.i2p.router.Router;
|
||||
import net.i2p.router.RouterContext;
|
||||
import net.i2p.util.RandomSource;
|
||||
|
||||
/**
|
||||
* simple helper to control restarts/shutdowns in the left hand nav
|
||||
@ -12,20 +13,18 @@ public class ConfigRestartBean {
|
||||
/** all these are tagged below so no need to _x them here.
|
||||
* order is: form value, form class, display text.
|
||||
*/
|
||||
static final String[] SET1 = {"shutdownImmediate", "stop", "Shutdown immediately", "cancelShutdown", "cancel", "Cancel shutdown"};
|
||||
static final String[] SET2 = {"restartImmediate", "reload", "Restart immediately", "cancelShutdown", "cancel", "Cancel restart"};
|
||||
static final String[] SET3 = {"restart", "reload", "Restart", "shutdown", "stop", "Shutdown"};
|
||||
static final String[] SET4 = {"shutdown", "stop", "Shutdown"};
|
||||
private static final String[] SET1 = {"shutdownImmediate", "stop", "Shutdown immediately", "cancelShutdown", "cancel", "Cancel shutdown"};
|
||||
private static final String[] SET2 = {"restartImmediate", "reload", "Restart immediately", "cancelShutdown", "cancel", "Cancel restart"};
|
||||
private static final String[] SET3 = {"restart", "reload", "Restart", "shutdown", "stop", "Shutdown"};
|
||||
private static final String[] SET4 = {"shutdown", "stop", "Shutdown"};
|
||||
|
||||
private static final String _systemNonce = Long.toString(RandomSource.getInstance().nextLong());
|
||||
|
||||
/** formerly System.getProperty("console.nonce") */
|
||||
public static String getNonce() {
|
||||
RouterContext ctx = ContextHelper.getContext(null);
|
||||
String nonce = System.getProperty("console.nonce");
|
||||
if (nonce == null) {
|
||||
nonce = ""+ctx.random().nextLong();
|
||||
System.setProperty("console.nonce", nonce);
|
||||
}
|
||||
return nonce;
|
||||
return _systemNonce;
|
||||
}
|
||||
|
||||
public static String renderStatus(String urlBase, String action, String nonce) {
|
||||
RouterContext ctx = ContextHelper.getContext(null);
|
||||
String systemNonce = getNonce();
|
||||
|
@ -194,8 +194,8 @@ public class FormHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
String sharedNonce = System.getProperty("router.consoleNonce");
|
||||
if ( (sharedNonce != null) && (sharedNonce.equals(_nonce) ) ) {
|
||||
String sharedNonce = CSSHelper.getNonce();
|
||||
if (sharedNonce.equals(_nonce)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -212,7 +212,7 @@ public class NewsHelper extends ContentHelper {
|
||||
ctx));
|
||||
}
|
||||
buf.append("</i>");
|
||||
String consoleNonce = System.getProperty("router.consoleNonce");
|
||||
String consoleNonce = CSSHelper.getNonce();
|
||||
if (lastUpdated > 0 && consoleNonce != null) {
|
||||
if (shouldShowNews(ctx)) {
|
||||
buf.append(" <a href=\"/?news=0&consoleNonce=").append(consoleNonce).append("\">")
|
||||
|
@ -606,7 +606,7 @@ public class SummaryBarRenderer {
|
||||
NewsHelper newshelper = _helper.getNewsHelper();
|
||||
if (newshelper == null || newshelper.shouldShowNews()) return "";
|
||||
StringBuilder buf = new StringBuilder(512);
|
||||
String consoleNonce = System.getProperty("router.consoleNonce");
|
||||
String consoleNonce = CSSHelper.getNonce();
|
||||
if (consoleNonce != null) {
|
||||
// Set up title and pre-headings stuff.
|
||||
buf.append("<h3><a href=\"/configupdate\">")
|
||||
|
@ -809,7 +809,13 @@ public class SummaryHelper extends HelperBase {
|
||||
|
||||
private String _requestURI;
|
||||
public void setRequestURI(String s) { _requestURI = s; }
|
||||
public String getRequestURI() { return _requestURI; }
|
||||
|
||||
/**
|
||||
* @return non-null; "/home" if (strangely) not set by jsp
|
||||
*/
|
||||
public String getRequestURI() {
|
||||
return _requestURI != null ? _requestURI : "/home";
|
||||
}
|
||||
|
||||
public String getConfigTable() {
|
||||
String[] allSections = SummaryBarRenderer.ALL_SECTIONS;
|
||||
|
Reference in New Issue
Block a user