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:
str4d
2012-06-11 23:33:33 +00:00
parent 296ddbe930
commit fa3e3e0764

View File

@ -19,7 +19,7 @@ public class CSSHelper extends HelperBase {
private static final String FORCE = "classic";
public static final String PROP_REFRESH = "routerconsole.summaryRefresh";
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";
public String getTheme(String userAgent) {
@ -71,12 +71,23 @@ public class CSSHelper extends HelperBase {
/** change refresh and save it */
public void setRefresh(String r) {
try {
if (Integer.parseInt(r) < MIN_REFRESH)
r = "" + MIN_REFRESH;
} catch (Exception e) {
}
_context.router().saveConfig(PROP_REFRESH, r);
}
/** @return refresh time in seconds, as a string */
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 */