forked from I2P_Developers/i2p.i2p
Enforcing minimum refresh rate better, and reducing it to 3 seconds
This does mean that the iframe don't-refresh state (= refresh rate of 0 seconds) doesn't hold if the page is changed (in fact, the refresh rate becomes the minimum) - so maybe better to have a different config var for that?
This commit is contained in:
@ -19,7 +19,7 @@ public class CSSHelper extends HelperBase {
|
|||||||
private static final String FORCE = "classic";
|
private static final String FORCE = "classic";
|
||||||
public static final String PROP_REFRESH = "routerconsole.summaryRefresh";
|
public static final String PROP_REFRESH = "routerconsole.summaryRefresh";
|
||||||
public static final String DEFAULT_REFRESH = "60";
|
public static final String DEFAULT_REFRESH = "60";
|
||||||
public static final int MIN_REFRESH = 5;
|
public static final int MIN_REFRESH = 3;
|
||||||
private static final String PROP_XFRAME = "routerconsole.disableXFrame";
|
private static final String PROP_XFRAME = "routerconsole.disableXFrame";
|
||||||
|
|
||||||
public String getTheme(String userAgent) {
|
public String getTheme(String userAgent) {
|
||||||
@ -71,12 +71,23 @@ public class CSSHelper extends HelperBase {
|
|||||||
|
|
||||||
/** change refresh and save it */
|
/** change refresh and save it */
|
||||||
public void setRefresh(String r) {
|
public void setRefresh(String r) {
|
||||||
|
try {
|
||||||
|
if (Integer.parseInt(r) < MIN_REFRESH)
|
||||||
|
r = "" + MIN_REFRESH;
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
_context.router().saveConfig(PROP_REFRESH, r);
|
_context.router().saveConfig(PROP_REFRESH, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return refresh time in seconds, as a string */
|
/** @return refresh time in seconds, as a string */
|
||||||
public String getRefresh() {
|
public String getRefresh() {
|
||||||
return _context.getProperty(PROP_REFRESH, DEFAULT_REFRESH);
|
String r = _context.getProperty(PROP_REFRESH, DEFAULT_REFRESH);
|
||||||
|
try {
|
||||||
|
if (Integer.parseInt(r) < MIN_REFRESH)
|
||||||
|
r = "" + MIN_REFRESH;
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** translate the title and display consistently */
|
/** translate the title and display consistently */
|
||||||
|
Reference in New Issue
Block a user