Console: Only show restart required on /configi2cp when interface changes
Some checks failed
Java CI / build (push) Failing after 3s
Java CI / javadoc-latest (push) Failing after 6s
Java CI / build-java7 (push) Failing after 6s
Dockerhub / docker (push) Failing after 20s
Java with IzPack Snapshot Setup / setup (push) Failing after 11s
Daily Workflow / daily-job (push) Failing after 5s
Daily Workflow / javadoc-latest (push) Failing after 7s
Daily Workflow / build-java7 (push) Failing after 7s

This commit is contained in:
zzz
2025-05-09 08:46:09 -04:00
parent 6b2689bb07
commit 8a216a4d7d

View File

@ -644,13 +644,18 @@ public class ConfigClientsHandler extends FormHandler {
* @since 0.8.3
*/
private void saveInterfaceChanges() {
boolean restart = false;
Map<String, String> changes = new HashMap<String, String>();
String port = getJettyString("port");
if (port != null)
if (port != null && !port.equals(_context.getProperty(ClientManagerFacadeImpl.PROP_CLIENT_PORT, "7654"))) {
changes.put(ClientManagerFacadeImpl.PROP_CLIENT_PORT, port);
restart = true;
}
String intfc = getJettyString("interface");
if (intfc != null)
if (intfc != null && !intfc.equals(_context.getProperty(ClientManagerFacadeImpl.PROP_CLIENT_HOST, "127.0.0.1"))) {
changes.put(ClientManagerFacadeImpl.PROP_CLIENT_HOST, intfc);
restart = true;
}
String user = getJettyString("user");
String pw = getJettyString("nofilter_pw");
if (user != null && pw != null && user.length() > 0 && pw.length() > 0) {
@ -661,18 +666,28 @@ public class ConfigClientsHandler extends FormHandler {
String mode = getJettyString("mode");
boolean disabled = "0".equals(mode);
boolean ssl = "2".equals(mode);
changes.put(ConfigClientsHelper.PROP_DISABLE_EXTERNAL,
if (disabled != _context.getProperty(ConfigClientsHelper.PROP_DISABLE_EXTERNAL, false)) {
changes.put(ConfigClientsHelper.PROP_DISABLE_EXTERNAL,
Boolean.toString(disabled));
changes.put(ConfigClientsHelper.PROP_ENABLE_SSL,
restart = true;
}
if (ssl != _context.getProperty(ConfigClientsHelper.PROP_ENABLE_SSL, false)) {
changes.put(ConfigClientsHelper.PROP_ENABLE_SSL,
Boolean.toString(ssl));
restart = true;
}
changes.put(ConfigClientsHelper.PROP_AUTH,
Boolean.toString((_settings.get("auth") != null)));
boolean all = "0.0.0.0".equals(intfc) || "0:0:0:0:0:0:0:0".equals(intfc) ||
"::".equals(intfc);
changes.put(ConfigClientsHelper.BIND_ALL_INTERFACES, Boolean.toString(all));
if (all != _context.getProperty(ConfigClientsHelper.BIND_ALL_INTERFACES, false)) {
changes.put(ConfigClientsHelper.BIND_ALL_INTERFACES, Boolean.toString(all));
restart = true;
}
if (_context.router().saveConfig(changes, null)) {
addFormNotice(_t("Interface configuration saved"));
addFormNotice(_t("Restart required to take effect"));
if (restart)
addFormNotice(_t("Restart required to take effect"));
} else
addFormError(_t("Error saving the configuration (applied but not saved) - please see the error logs"));
}