diff --git a/package-lock.json b/package-lock.json index cf5ff68c..8fb4c7a1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -32,7 +32,7 @@ "express-basic-auth": "~1.2.1", "express-static-gzip": "~2.1.7", "form-data": "~4.0.0", - "gamedig": "~4.1.0", + "gamedig": "^4.2.0", "html-escaper": "^3.0.3", "http-cookie-agent": "~5.0.4", "http-graceful-shutdown": "~3.1.7", @@ -66,6 +66,7 @@ "playwright-core": "~1.35.1", "prom-client": "~13.2.0", "prometheus-api-metrics": "~3.2.1", + "promisify-child-process": "~4.1.2", "protobufjs": "~7.2.4", "qs": "~6.10.4", "redbean-node": "~0.3.0", @@ -141,7 +142,7 @@ "vue-router": "~4.0.14", "vue-toastification": "~2.0.0-rc.5", "vuedraggable": "~4.1.0", - "wait-on": "^6.0.1", + "wait-on": "^7.2.0", "whatwg-url": "~12.0.1" }, "engines": { @@ -8531,9 +8532,9 @@ } }, "node_modules/gamedig": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/gamedig/-/gamedig-4.1.0.tgz", - "integrity": "sha512-jvLUEakihJgpiw9t9yQRsbcemeALeTNlnaWY1gvYdwI63ZlkxznTaLqX5K/eluRTTCtAWNW3YceT6NVjyAZIwA==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/gamedig/-/gamedig-4.2.0.tgz", + "integrity": "sha512-UwV9gT1PrOTxjwGzj9/i8XJLx9QqmzFtrRJnRLqN7fZWEIRHjbuUpx2b6Y3v/5QyRDFP+vaB3Pm0hw3Xg4RnOQ==", "dependencies": { "cheerio": "^1.0.0-rc.10", "gbxremote": "^0.2.1", @@ -12983,6 +12984,14 @@ "node": ">=10" } }, + "node_modules/promisify-child-process": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/promisify-child-process/-/promisify-child-process-4.1.2.tgz", + "integrity": "sha512-APnkIgmaHNJpkAn7k+CrJSi9WMuff5ctYFbD0CO2XIPkM8yO7d/ShouU2clywbpHV/DUsyc4bpJCsNgddNtx4g==", + "engines": { + "node": ">=8" + } + }, "node_modules/prompts": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", @@ -16117,31 +16126,33 @@ } }, "node_modules/wait-on": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/wait-on/-/wait-on-6.0.1.tgz", - "integrity": "sha512-zht+KASY3usTY5u2LgaNqn/Cd8MukxLGjdcZxT2ns5QzDmTFc4XoWBgC+C/na+sMRZTuVygQoMYwdcVjHnYIVw==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/wait-on/-/wait-on-7.2.0.tgz", + "integrity": "sha512-wCQcHkRazgjG5XoAq9jbTMLpNIjoSlZslrJ2+N9MxDsGEv1HnFoVjOCexL0ESva7Y9cu350j+DWADdk54s4AFQ==", "dev": true, "dependencies": { - "axios": "^0.25.0", - "joi": "^17.6.0", + "axios": "^1.6.1", + "joi": "^17.11.0", "lodash": "^4.17.21", - "minimist": "^1.2.5", - "rxjs": "^7.5.4" + "minimist": "^1.2.8", + "rxjs": "^7.8.1" }, "bin": { "wait-on": "bin/wait-on" }, "engines": { - "node": ">=10.0.0" + "node": ">=12.0.0" } }, "node_modules/wait-on/node_modules/axios": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.25.0.tgz", - "integrity": "sha512-cD8FOb0tRH3uuEe6+evtAbgJtfxr7ly3fQjYcMcuPlgkwVS9xboaVIpcDV+cYQe+yGykgwZCs1pzjntcGa6l5g==", + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.2.tgz", + "integrity": "sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==", "dev": true, "dependencies": { - "follow-redirects": "^1.14.7" + "follow-redirects": "^1.15.0", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" } }, "node_modules/wait-on/node_modules/joi": { @@ -16157,6 +16168,12 @@ "@sideway/pinpoint": "^2.0.0" } }, + "node_modules/wait-on/node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", + "dev": true + }, "node_modules/walker": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz", diff --git a/package.json b/package.json index 681efb9d..d278bb21 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "build-docker-nightly-local": "npm run build && docker build -f docker/dockerfile -t louislam/uptime-kuma:nightly2 --target nightly .", "build-docker-pr-test": "docker buildx build -f docker/dockerfile --platform linux/amd64,linux/arm64 -t louislam/uptime-kuma:pr-test2 --target pr-test2 . --push", "upload-artifacts": "docker buildx build -f docker/dockerfile --platform linux/amd64 -t louislam/uptime-kuma:upload-artifact --build-arg VERSION --build-arg GITHUB_TOKEN --target upload-artifact . --progress plain", - "setup": "git checkout 1.23.7 && npm ci --production && npm run download-dist", + "setup": "git checkout 1.23.8 && npm ci --production && npm run download-dist", "download-dist": "node extra/download-dist.js", "mark-as-nightly": "node extra/mark-as-nightly.js", "reset-password": "node extra/reset-password.js", @@ -96,7 +96,7 @@ "express-basic-auth": "~1.2.1", "express-static-gzip": "~2.1.7", "form-data": "~4.0.0", - "gamedig": "~4.1.0", + "gamedig": "^4.2.0", "http-cookie-agent": "~5.0.4", "html-escaper": "^3.0.3", "http-graceful-shutdown": "~3.1.7", @@ -130,6 +130,7 @@ "playwright-core": "~1.35.1", "prom-client": "~13.2.0", "prometheus-api-metrics": "~3.2.1", + "promisify-child-process": "~4.1.2", "protobufjs": "~7.2.4", "qs": "~6.10.4", "redbean-node": "~0.3.0", @@ -205,7 +206,7 @@ "vue-router": "~4.0.14", "vue-toastification": "~2.0.0-rc.5", "vuedraggable": "~4.1.0", - "wait-on": "^6.0.1", + "wait-on": "^7.2.0", "whatwg-url": "~12.0.1" } } diff --git a/server/monitor-types/real-browser-monitor-type.js b/server/monitor-types/real-browser-monitor-type.js index 1bf5091a..c03d36ca 100644 --- a/server/monitor-types/real-browser-monitor-type.js +++ b/server/monitor-types/real-browser-monitor-type.js @@ -44,6 +44,7 @@ if (process.platform === "win32") { "/usr/bin/chromium", "/usr/bin/chromium-browser", "/usr/bin/google-chrome", + "/snap/bin/chromium", // Ubuntu ]; } else if (process.platform === "darwin") { allowedList = [ diff --git a/server/monitor-types/tailscale-ping.js b/server/monitor-types/tailscale-ping.js index 2f26894f..1549ac4e 100644 --- a/server/monitor-types/tailscale-ping.js +++ b/server/monitor-types/tailscale-ping.js @@ -1,6 +1,6 @@ const { MonitorType } = require("./monitor-type"); const { UP } = require("../../src/util"); -const childProcess = require("child_process"); +const childProcessAsync = require("promisify-child-process"); /** * A TailscalePing class extends the MonitorType. @@ -37,12 +37,9 @@ class TailscalePing extends MonitorType { */ async runTailscalePing(hostname, interval) { let timeout = interval * 1000 * 0.8; - let res = childProcess.spawnSync("tailscale", [ "ping", hostname ], { + let res = await childProcessAsync.spawn("tailscale", [ "ping", "--c", "1", hostname ], { timeout: timeout }); - if (res.error) { - throw new Error(`Execution error: ${res.error.message}`); - } if (res.stderr && res.stderr.toString()) { throw new Error(`Error in output: ${res.stderr.toString()}`); } diff --git a/server/notification-providers/apprise.js b/server/notification-providers/apprise.js index b624b910..81199358 100644 --- a/server/notification-providers/apprise.js +++ b/server/notification-providers/apprise.js @@ -1,5 +1,5 @@ const NotificationProvider = require("./notification-provider"); -const childProcess = require("child_process"); +const childProcessAsync = require("promisify-child-process"); class Apprise extends NotificationProvider { @@ -14,7 +14,7 @@ class Apprise extends NotificationProvider { args.push("-t"); args.push(notification.title); } - const s = childProcess.spawnSync("apprise", args); + const s = await childProcessAsync.spawn("apprise", args); const output = (s.stdout) ? s.stdout.toString() : "ERROR: maybe apprise not found"; diff --git a/server/server.js b/server/server.js index 18bc6b0c..0be9a972 100644 --- a/server/server.js +++ b/server/server.js @@ -1337,9 +1337,9 @@ let needSetup = false; // Update nscd status if (previousNSCDStatus !== data.nscd) { if (data.nscd) { - server.startNSCDServices(); + await server.startNSCDServices(); } else { - server.stopNSCDServices(); + await server.stopNSCDServices(); } } diff --git a/server/uptime-kuma-server.js b/server/uptime-kuma-server.js index 67321abc..f55dcde3 100644 --- a/server/uptime-kuma-server.js +++ b/server/uptime-kuma-server.js @@ -10,7 +10,7 @@ const util = require("util"); const { CacheableDnsHttpAgent } = require("./cacheable-dns-http-agent"); const { Settings } = require("./settings"); const dayjs = require("dayjs"); -const childProcess = require("child_process"); +const childProcessAsync = require("promisify-child-process"); const path = require("path"); const axios = require("axios"); // DO NOT IMPORT HERE IF THE MODULES USED `UptimeKumaServer.getInstance()`, put at the bottom of this file instead. @@ -372,7 +372,7 @@ class UptimeKumaServer { let enable = await Settings.get("nscd"); if (enable || enable === null) { - this.startNSCDServices(); + await this.startNSCDServices(); } } @@ -384,7 +384,7 @@ class UptimeKumaServer { let enable = await Settings.get("nscd"); if (enable || enable === null) { - this.stopNSCDServices(); + await this.stopNSCDServices(); } } @@ -393,11 +393,11 @@ class UptimeKumaServer { * For now, only used in Docker * @returns {void} */ - startNSCDServices() { + async startNSCDServices() { if (process.env.UPTIME_KUMA_IS_CONTAINER) { try { log.info("services", "Starting nscd"); - childProcess.execSync("sudo service nscd start", { stdio: "pipe" }); + await childProcessAsync.exec("sudo service nscd start"); } catch (e) { log.info("services", "Failed to start nscd"); } @@ -408,11 +408,11 @@ class UptimeKumaServer { * Stop all system services * @returns {void} */ - stopNSCDServices() { + async stopNSCDServices() { if (process.env.UPTIME_KUMA_IS_CONTAINER) { try { log.info("services", "Stopping nscd"); - childProcess.execSync("sudo service nscd stop"); + await childProcessAsync.exec("sudo service nscd stop"); } catch (e) { log.info("services", "Failed to stop nscd"); } diff --git a/src/components/ActionInput.vue b/src/components/ActionInput.vue index fe3504b1..44c9e586 100644 --- a/src/components/ActionInput.vue +++ b/src/components/ActionInput.vue @@ -8,9 +8,9 @@ :placeholder="placeholder" :disabled="!enabled" > - + @@ -66,6 +66,13 @@ export default { action: { type: Function, default: () => {}, + }, + /** + * The aria-label of the action button + */ + actionAriaLabel: { + type: String, + required: true, } }, emits: [ "update:modelValue" ], diff --git a/src/components/ActionSelect.vue b/src/components/ActionSelect.vue index 78daebc2..b163cd3a 100644 --- a/src/components/ActionSelect.vue +++ b/src/components/ActionSelect.vue @@ -1,11 +1,11 @@ @@ -20,6 +20,13 @@ export default { type: Array, default: () => [], }, + /** + * The id of the form which will be targeted by a