Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/1.21.X'
Browse files Browse the repository at this point in the history
# Conflicts:
#	package-lock.json
  • Loading branch information
louislam committed May 8, 2023
2 parents 8a3bce4 + 1a344c1 commit 7f5d0e5
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 21 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "uptime-kuma",
"version": "1.21.2",
"version": "1.21.3",
"license": "MIT",
"repository": {
"type": "git",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
1 change: 0 additions & 1 deletion server/database.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down
9 changes: 5 additions & 4 deletions server/model/maintenance.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
};
Expand Down Expand Up @@ -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]) {
Expand Down Expand Up @@ -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();

Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion server/notification-providers/opsgenie.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
7 changes: 5 additions & 2 deletions server/notification-providers/telegram.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
}
Expand Down
16 changes: 7 additions & 9 deletions src/pages/EditMaintenance.vue
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@
<label for="timezone" class="form-label">
{{ $t("Timezone") }}
</label>
<select id="timezone" v-model="maintenance.timezone" class="form-select">
<option :value="null">{{ $t("sameAsServerTimezone") }}</option>
<select id="timezone" v-model="maintenance.timezoneOption" class="form-select">
<option value="SAME_AS_SERVER">{{ $t("sameAsServerTimezone") }}</option>
<option value="UTC">UTC</option>
<option
v-for="(timezone, index) in timezoneList"
Expand All @@ -218,17 +218,17 @@

<!-- Date Range -->
<div class="my-3">
<label class="form-label">{{ $t("Effective Date Range") }}</label>
<label v-if="maintenance.strategy !== 'single'" class="form-label">{{ $t("Effective Date Range") }}</label>

<div class="row">
<div class="col">
<div class="mb-2">{{ $t("startDateTime") }}</div>
<input v-model="maintenance.dateRange[0]" type="datetime-local" class="form-control">
<input v-model="maintenance.dateRange[0]" type="datetime-local" class="form-control" :required="maintenance.strategy === 'single'">
</div>

<div class="col">
<div class="mb-2">{{ $t("endDateTime") }}</div>
<input v-model="maintenance.dateRange[1]" type="datetime-local" class="form-control">
<input v-model="maintenance.dateRange[1]" type="datetime-local" class="form-control" :required="maintenance.strategy === 'single'">
</div>
</div>
</div>
Expand All @@ -248,7 +248,6 @@
<script>
import { useToast } from "vue-toastification";
import VueMultiselect from "vue-multiselect";
import dayjs from "dayjs";
import Datepicker from "@vuepic/vue-datepicker";
import { timezoneList } from "../util-frontend";
import cronstrue from "cronstrue/i18n";
Expand All @@ -272,7 +271,6 @@ export default {
selectedStatusPages: [],
dark: (this.$root.theme === "dark"),
neverEnd: false,
minDate: this.$root.date(dayjs()) + " 00:00",
lastDays: [
{
langKey: "lastDay1",
Expand Down Expand Up @@ -411,7 +409,7 @@ export default {
cron: "30 3 * * *",
durationMinutes: 60,
intervalDay: 1,
dateRange: [ this.minDate ],
dateRange: [],
timeRange: [{
hours: 2,
minutes: 0,
Expand All @@ -421,7 +419,7 @@ export default {
}],
weekdays: [],
daysOfMonth: [],
timezone: null,
timezoneOption: null,
};
} else if (this.isEdit) {
this.$root.getSocket().emit("getMaintenance", this.$route.params.id, (res) => {
Expand Down

0 comments on commit 7f5d0e5

Please sign in to comment.