diff --git a/server/client.js b/server/client.js index 2e3bd43b7..7891dd166 100644 --- a/server/client.js +++ b/server/client.js @@ -147,15 +147,18 @@ async function sendAPIKeyList(socket) { async function sendInfo(socket, hideVersion = false) { let version; let latestVersion; + let isContainer; if (!hideVersion) { version = checkVersion.version; latestVersion = checkVersion.latestVersion; + isContainer = (process.env.UPTIME_KUMA_IS_CONTAINER === "1"); } socket.emit("info", { version, latestVersion, + isContainer, primaryBaseURL: await setting("primaryBaseURL"), serverTimezone: await server.getTimezone(), serverTimezoneOffset: server.getTimezoneOffset(), diff --git a/server/server.js b/server/server.js index 59957ba96..25a7d4725 100644 --- a/server/server.js +++ b/server/server.js @@ -1194,6 +1194,7 @@ let needSetup = false; } const previousChromeExecutable = await Settings.get("chromeExecutable"); + const previousNSCDStatus = await Settings.get("nscd"); await setSettings("general", data); server.entryPage = data.entryPage; @@ -1211,6 +1212,15 @@ let needSetup = false; await resetChrome(); } + // Update nscd status + if (previousNSCDStatus !== data.nscd) { + if (data.nscd) { + server.startNSCDServices(); + } else { + server.stopNSCDServices(); + } + } + callback({ ok: true, msg: "Saved" diff --git a/server/uptime-kuma-server.js b/server/uptime-kuma-server.js index 7817c9e1c..6acc8d4df 100644 --- a/server/uptime-kuma-server.js +++ b/server/uptime-kuma-server.js @@ -341,7 +341,11 @@ class UptimeKumaServer { * @returns {Promise} */ async start() { - this.startServices(); + let enable = await Settings.get("nscd"); + + if (enable || enable === null) { + this.startNSCDServices(); + } } /** @@ -349,14 +353,18 @@ class UptimeKumaServer { * @returns {Promise} */ async stop() { - this.stopServices(); + let enable = await Settings.get("nscd"); + + if (enable || enable === null) { + this.stopNSCDServices(); + } } /** * Start all system services (e.g. nscd) * For now, only used in Docker */ - startServices() { + startNSCDServices() { if (process.env.UPTIME_KUMA_IS_CONTAINER) { try { log.info("services", "Starting nscd"); @@ -370,7 +378,7 @@ class UptimeKumaServer { /** * Stop all system services */ - stopServices() { + stopNSCDServices() { if (process.env.UPTIME_KUMA_IS_CONTAINER) { try { log.info("services", "Stopping nscd"); diff --git a/src/components/settings/General.vue b/src/components/settings/General.vue index 9f9a88b65..f8a0d48f2 100644 --- a/src/components/settings/General.vue +++ b/src/components/settings/General.vue @@ -150,6 +150,43 @@ + +
+ + +
+ + +
+ +
+ + +
+
+