diff --git a/package.json b/package.json index ab1ad8c8..342fd425 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "uptime-kuma", - "version": "1.21.2", + "version": "1.21.3", "license": "MIT", "repository": { "type": "git", @@ -39,7 +39,7 @@ "build-docker-nightly-amd64": "docker buildx build -f docker/dockerfile --platform linux/amd64 -t louislam/uptime-kuma:nightly-amd64 --target nightly . --push --progress plain", "build-docker-pr-test": "docker buildx build -f docker/dockerfile --platform linux/amd64,linux/arm64 -t louislam/uptime-kuma:pr-test --target pr-test . --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.21.2 && npm ci --production && npm run download-dist", + "setup": "git checkout 1.21.3 && 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", @@ -119,8 +119,8 @@ "qs": "~6.10.4", "redbean-node": "~0.2.0", "redis": "~4.5.1", - "socket.io": "~4.5.3", - "socket.io-client": "~4.5.3", + "socket.io": "~4.6.1", + "socket.io-client": "~4.6.1", "socks-proxy-agent": "6.1.1", "tar": "~6.1.11", "tcp-ping": "~0.1.1", diff --git a/server/database.js b/server/database.js index 93f734cb..c31e07c8 100644 --- a/server/database.js +++ b/server/database.js @@ -2,7 +2,6 @@ const fs = require("fs"); const { R } = require("redbean-node"); const { setSetting, setting } = require("./util-server"); const { log, sleep } = require("../src/util"); -const dayjs = require("dayjs"); const knex = require("knex"); const { PluginsManager } = require("./plugins-manager"); diff --git a/server/model/maintenance.js b/server/model/maintenance.js index 787953fb..f18eb026 100644 --- a/server/model/maintenance.js +++ b/server/model/maintenance.js @@ -47,7 +47,8 @@ class Maintenance extends BeanModel { cron: this.cron, duration: this.duration, durationMinutes: parseInt(this.duration / 60), - timezone: await this.getTimezone(), + timezone: await this.getTimezone(), // Only valid timezone + timezoneOption: this.timezone, // Mainly for dropdown menu, because there is a option "SAME_AS_SERVER" timezoneOffset: await this.getTimezoneOffset(), status: await this.getStatus(), }; @@ -153,7 +154,7 @@ class Maintenance extends BeanModel { bean.description = obj.description; bean.strategy = obj.strategy; bean.interval_day = obj.intervalDay; - bean.timezone = obj.timezone; + bean.timezone = obj.timezoneOption; bean.active = obj.active; if (obj.dateRange[0]) { @@ -290,7 +291,7 @@ class Maintenance extends BeanModel { } getRunningTimeslot() { - let start = dayjs(this.beanMeta.job.nextRun(dayjs().add(-this.duration, "second").format("YYYY-MM-DD HH:mm:ss"))); + let start = dayjs(this.beanMeta.job.nextRun(dayjs().add(-this.duration, "second").toDate())); let end = start.add(this.duration, "second"); let current = dayjs(); @@ -316,7 +317,7 @@ class Maintenance extends BeanModel { } async getTimezone() { - if (!this.timezone) { + if (!this.timezone || this.timezone === "SAME_AS_SERVER") { return await UptimeKumaServer.getInstance().getTimezone(); } return this.timezone; diff --git a/server/notification-providers/opsgenie.js b/server/notification-providers/opsgenie.js index 16bf9fc6..5fa7f3e4 100644 --- a/server/notification-providers/opsgenie.js +++ b/server/notification-providers/opsgenie.js @@ -15,7 +15,7 @@ class Opsgenie extends NotificationProvider { */ async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { let opsgenieAlertsUrl; - let priority = (notification.opsgeniePriority == "") ? 3 : notification.opsgeniePriority; + let priority = (!notification.opsgeniePriority) ? 3 : notification.opsgeniePriority; const textMsg = "Uptime Kuma Alert"; try { diff --git a/server/notification-providers/telegram.js b/server/notification-providers/telegram.js index 3c490655..561cabd8 100644 --- a/server/notification-providers/telegram.js +++ b/server/notification-providers/telegram.js @@ -25,8 +25,11 @@ class Telegram extends NotificationProvider { return okMsg; } catch (error) { - let msg = (error.response.data.description) ? error.response.data.description : "Error without description"; - throw new Error(msg); + if (error.response && error.response.data && error.response.data.description) { + throw new Error(error.response.data.description); + } else { + throw new Error(error.message); + } } } } diff --git a/src/pages/EditMaintenance.vue b/src/pages/EditMaintenance.vue index eb9ef7fd..d3ec1737 100644 --- a/src/pages/EditMaintenance.vue +++ b/src/pages/EditMaintenance.vue @@ -203,8 +203,8 @@ - +