@Override
public void set(String val) throws InvalidConfigValueException {
try {
allowedFullAccess.setAllowedHosts(val);
} catch(IllegalArgumentException e) {
throw new InvalidConfigValueException(e);
}
}
});
allowedFullAccess = new AllowedHosts(fproxyConfig.getString("allowedHostsFullAccess"));
fproxyConfig.register("doRobots", false, configItemOrder++, true, false, "SimpleToadletServer.doRobots", "SimpleToadletServer.doRobotsLong",
new BooleanCallback() {
@Override
public Boolean get() {
return doRobots;
}
@Override
public void set(Boolean val) throws InvalidConfigValueException {
doRobots = val;
}
});
doRobots = fproxyConfig.getBoolean("doRobots");
// We may not know what the overall thread limit is yet so just set it to 100.
fproxyConfig.register("maxFproxyConnections", 100, configItemOrder++, true, false, "SimpleToadletServer.maxFproxyConnections", "SimpleToadletServer.maxFproxyConnectionsLong",
new IntCallback() {
@Override
public Integer get() {
synchronized(SimpleToadletServer.this) {
return maxFproxyConnections;
}
}
@Override
public void set(Integer val) {
synchronized(SimpleToadletServer.this) {
maxFproxyConnections = val;
SimpleToadletServer.this.notifyAll();
}
}
}, false);
maxFproxyConnections = fproxyConfig.getInt("maxFproxyConnections");
fproxyConfig.register("metaRefreshSamePageInterval", 1, configItemOrder++, true, false, "SimpleToadletServer.metaRefreshSamePageInterval", "SimpleToadletServer.metaRefreshSamePageIntervalLong",
new IntCallback() {
@Override
public Integer get() {
return HTMLFilter.metaRefreshSamePageMinInterval;
}
@Override
public void set(Integer val)
throws InvalidConfigValueException,
NodeNeedRestartException {
if(val < -1) throw new InvalidConfigValueException("-1 = disabled, 0+ = set a minimum interval"); // FIXME l10n
HTMLFilter.metaRefreshSamePageMinInterval = val;
}
}, false);
HTMLFilter.metaRefreshSamePageMinInterval = Math.max(-1, fproxyConfig.getInt("metaRefreshSamePageInterval"));
fproxyConfig.register("metaRefreshRedirectInterval", 1, configItemOrder++, true, false, "SimpleToadletServer.metaRefreshRedirectInterval", "SimpleToadletServer.metaRefreshRedirectIntervalLong",
new IntCallback() {
@Override
public Integer get() {
return HTMLFilter.metaRefreshRedirectMinInterval;
}
@Override
public void set(Integer val)
throws InvalidConfigValueException,
NodeNeedRestartException {
if(val < -1) throw new InvalidConfigValueException("-1 = disabled, 0+ = set a minimum interval"); // FIXME l10n
HTMLFilter.metaRefreshRedirectMinInterval = val;
}
}, false);
HTMLFilter.metaRefreshRedirectMinInterval = Math.max(-1, fproxyConfig.getInt("metaRefreshRedirectInterval"));
fproxyConfig.register("refilterPolicy", "RE_FILTER",
configItemOrder++, true, false, "SimpleToadletServer.refilterPolicy", "SimpleToadletServer.refilterPolicyLong", new ReFilterCallback());
this.refilterPolicy = REFILTER_POLICY.valueOf(fproxyConfig.getString("refilterPolicy"));
// Network seclevel not physical seclevel because bad filtering can cause network level anonymity breaches.
SimpleToadletServer.isPanicButtonToBeShown = fproxyConfig.getBoolean("showPanicButton");
SimpleToadletServer.noConfirmPanic = fproxyConfig.getBoolean("noConfirmPanic");
this.bf = bucketFactory;
port = fproxyConfig.getInt("port");
bindTo = fproxyConfig.getString("bindTo");
String cssName = fproxyConfig.getString("css");
if((cssName.indexOf(':') != -1) || (cssName.indexOf('/') != -1))
throw new InvalidConfigValueException("CSS name must not contain slashes or colons!");
cssTheme = THEME.themeFromName(cssName);
pageMaker = new PageMaker(cssTheme, node);
if(!fproxyConfig.getOption("CSSOverride").isDefault()) {
cssOverride = new File(fproxyConfig.getString("CSSOverride"));