Fixed settingsAck_p.html back link for case where referrer is stripped.

pull/114/head
luccioman 8 years ago
parent 18c7563dbe
commit 79df5bb20a

@ -33,7 +33,6 @@ import java.util.StringTokenizer;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException; import java.util.regex.PatternSyntaxException;
import net.yacy.cora.document.id.MultiProtocolURL;
import net.yacy.cora.order.Digest; import net.yacy.cora.order.Digest;
import net.yacy.cora.protocol.RequestHeader; import net.yacy.cora.protocol.RequestHeader;
import net.yacy.kelondro.util.Formatter; import net.yacy.kelondro.util.Formatter;
@ -56,9 +55,8 @@ public class SettingsAck_p {
final serverObjects prop = new serverObjects(); final serverObjects prop = new serverObjects();
final Switchboard sb = (Switchboard) env; final Switchboard sb = (Switchboard) env;
// get referer for backlink // set default backlink
final MultiProtocolURL referer = header.referer(); prop.put("needsRestart_referer", "Settings_p.html");
prop.put("needsRestart_referer", (referer == null) ? "Settings_p.html" : referer.toNormalform(true));
prop.put("needsRestart", false); prop.put("needsRestart", false);
//if (post == null) System.out.println("POST: NULL"); else System.out.println("POST: " + post.toString()); //if (post == null) System.out.println("POST: NULL"); else System.out.println("POST: " + post.toString());
@ -97,6 +95,9 @@ public class SettingsAck_p {
// proxy password // proxy password
if (post.containsKey("proxyaccount")) { if (post.containsKey("proxyaccount")) {
// set backlink
prop.put("needsRestart_referer", "Settings_p.html?page=ProxyAccess");
/* /*
* display port info * display port info
*/ */
@ -150,6 +151,9 @@ public class SettingsAck_p {
// http networking // http networking
if (post.containsKey("httpNetworking")) { if (post.containsKey("httpNetworking")) {
// set backlink
prop.put("needsRestart_referer", "Settings_p.html?page=ProxyAccess");
// set transparent proxy flag // set transparent proxy flag
boolean isTransparentProxy = post.containsKey("isTransparentProxy"); boolean isTransparentProxy = post.containsKey("isTransparentProxy");
@ -169,13 +173,15 @@ public class SettingsAck_p {
// setting X-Forwarded-for header property // setting X-Forwarded-for header property
env.setConfig("proxy.sendXForwardedForHeader", post.containsKey("proxy.sendXForwardedForHeader")); env.setConfig("proxy.sendXForwardedForHeader", post.containsKey("proxy.sendXForwardedForHeader"));
prop.put("info_proxy.sendXForwardedForHeader", post.containsKey("proxy.sendXForwardedForHeader")? "on" : "off"); prop.put("info_proxy.sendXForwardedForHeader", post.containsKey("proxy.sendXForwardedForHeader")? "on" : "off");
prop.put("info", "20"); prop.put("info", "20");
return prop; return prop;
} }
// server access // server access
if (post.containsKey("serveraccount")) { if (post.containsKey("serveraccount")) {
// set backlink
prop.put("needsRestart_referer", "Settings_p.html?page=ServerAccess");
// fileHost // fileHost
String fileHost = (post.get("fileHost")).trim(); String fileHost = (post.get("fileHost")).trim();
@ -252,6 +258,8 @@ public class SettingsAck_p {
} }
if (post.containsKey("proxysettings")) { if (post.containsKey("proxysettings")) {
// set backlink
prop.put("needsRestart_referer", "Settings_p.html?page=proxy");
/* ==================================================================== /* ====================================================================
* Reading out the remote proxy settings * Reading out the remote proxy settings
@ -289,6 +297,9 @@ public class SettingsAck_p {
} }
if (post.containsKey("urlproxySettings")) { if (post.containsKey("urlproxySettings")) {
// set backlink
prop.put("needsRestart_referer", "Settings_p.html?page=UrlProxyAccess");
env.setConfig("proxyURL.access", post.get("urlproxyfilter")); env.setConfig("proxyURL.access", post.get("urlproxyfilter"));
env.setConfig("proxyURL.rewriteURLs", post.get("urlproxydomains")); env.setConfig("proxyURL.rewriteURLs", post.get("urlproxydomains"));
env.setConfig("proxyURL", "on".equals(post.get("urlproxyenabled")) ? true : false); env.setConfig("proxyURL", "on".equals(post.get("urlproxyenabled")) ? true : false);
@ -299,6 +310,9 @@ public class SettingsAck_p {
} }
if (post.containsKey("seedUploadRetry")) { if (post.containsKey("seedUploadRetry")) {
// set backlink
prop.put("needsRestart_referer", "Settings_p.html?page=seed");
String error; String error;
if ((error = Network.saveSeedList(sb)) == null) { if ((error = Network.saveSeedList(sb)) == null) {
// trying to upload the seed-list file // trying to upload the seed-list file
@ -313,6 +327,9 @@ public class SettingsAck_p {
} }
if (post.containsKey("seedSettings")) { if (post.containsKey("seedSettings")) {
// set backlink
prop.put("needsRestart_referer", "Settings_p.html?page=seed");
// get the currently used uploading method // get the currently used uploading method
final String oldSeedUploadMethod = env.getConfig("seedUploadMethod","none"); final String oldSeedUploadMethod = env.getConfig("seedUploadMethod","none");
final String newSeedUploadMethod = post.get("seedUploadMethod"); final String newSeedUploadMethod = post.get("seedUploadMethod");
@ -346,6 +363,11 @@ public class SettingsAck_p {
return prop; return prop;
} }
} }
if (post.containsKey("seedFileSettings") || post.containsKey("seedFtpSettings") || post.containsKey("seedScpSettings")) {
// set backlink
prop.put("needsRestart_referer", "Settings_p.html?page=seed");
}
/* /*
* Loop through the available seed uploaders to see if the * Loop through the available seed uploaders to see if the
@ -406,6 +428,9 @@ public class SettingsAck_p {
* Message forwarding configuration * Message forwarding configuration
*/ */
if (post.containsKey("msgForwarding")) { if (post.containsKey("msgForwarding")) {
// set backlink
prop.put("needsRestart_referer", "Settings_p.html?page=messageForwarding");
env.setConfig("msgForwardingEnabled", post.containsKey("msgForwardingEnabled")); env.setConfig("msgForwardingEnabled", post.containsKey("msgForwardingEnabled"));
env.setConfig("msgForwardingCmd", post.get("msgForwardingCmd")); env.setConfig("msgForwardingCmd", post.get("msgForwardingCmd"));
env.setConfig("msgForwardingTo", post.get("msgForwardingTo")); env.setConfig("msgForwardingTo", post.get("msgForwardingTo"));
@ -420,6 +445,9 @@ public class SettingsAck_p {
// Crawler settings // Crawler settings
if (post.containsKey("crawlerSettings")) { if (post.containsKey("crawlerSettings")) {
// set backlink
prop.put("needsRestart_referer", "Settings_p.html?page=crawler");
// get Crawler Timeout // get Crawler Timeout
String timeoutStr = post.get("crawler.clientTimeout"); String timeoutStr = post.get("crawler.clientTimeout");
@ -505,6 +533,10 @@ public class SettingsAck_p {
// change https port // change https port
if (post.containsKey("port.ssl")) { if (post.containsKey("port.ssl")) {
// set backlink
prop.put("needsRestart_referer", "Settings_p.html?page=ProxyAccess");
int port = post.getInt("port.ssl", 8443); int port = post.getInt("port.ssl", 8443);
if (port > 0 && port != env.getConfigInt("port.ssl", 8443)) { if (port > 0 && port != env.getConfigInt("port.ssl", 8443)) {
env.setConfig("port.ssl", port); env.setConfig("port.ssl", port);
@ -516,6 +548,9 @@ public class SettingsAck_p {
// Debug/Analysis settings // Debug/Analysis settings
if (post.containsKey("debugAnalysisSettings")) { if (post.containsKey("debugAnalysisSettings")) {
// set backlink
prop.put("needsRestart_referer", "Settings_p.html?page=debug");
boolean tickedCheckbox = post.containsKey("solrBinaryResponse"); boolean tickedCheckbox = post.containsKey("solrBinaryResponse");
env.setConfig(SwitchboardConstants.REMOTE_SOLR_BINARY_RESPONSE_ENABLED, tickedCheckbox); env.setConfig(SwitchboardConstants.REMOTE_SOLR_BINARY_RESPONSE_ENABLED, tickedCheckbox);
@ -549,6 +584,9 @@ public class SettingsAck_p {
// Referrer Policy settings // Referrer Policy settings
if (post.containsKey("referrerPolicySettings")) { if (post.containsKey("referrerPolicySettings")) {
// set backlink
prop.put("needsRestart_referer", "Settings_p.html?page=referrer");
String metaPolicy = post.get("metaPolicy", SwitchboardConstants.REFERRER_META_POLICY_DEFAULT); String metaPolicy = post.get("metaPolicy", SwitchboardConstants.REFERRER_META_POLICY_DEFAULT);
env.setConfig(SwitchboardConstants.REFERRER_META_POLICY, metaPolicy); env.setConfig(SwitchboardConstants.REFERRER_META_POLICY, metaPolicy);

Loading…
Cancel
Save