mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-06-06 13:12:33 +02:00
Merge branch 'master' into fix-maintenance
This commit is contained in:
commit
c3f0cc4a5b
5 changed files with 36 additions and 21 deletions
|
@ -15,11 +15,13 @@ const server = UptimeKumaServer.getInstance();
|
||||||
|
|
||||||
router.get("/status/:slug", cache("5 minutes"), async (request, response) => {
|
router.get("/status/:slug", cache("5 minutes"), async (request, response) => {
|
||||||
let slug = request.params.slug;
|
let slug = request.params.slug;
|
||||||
|
slug = slug.toLowerCase();
|
||||||
await StatusPage.handleStatusPageResponse(response, server.indexHTML, slug);
|
await StatusPage.handleStatusPageResponse(response, server.indexHTML, slug);
|
||||||
});
|
});
|
||||||
|
|
||||||
router.get("/status/:slug/rss", cache("5 minutes"), async (request, response) => {
|
router.get("/status/:slug/rss", cache("5 minutes"), async (request, response) => {
|
||||||
let slug = request.params.slug;
|
let slug = request.params.slug;
|
||||||
|
slug = slug.toLowerCase();
|
||||||
await StatusPage.handleStatusPageRSSResponse(response, slug);
|
await StatusPage.handleStatusPageRSSResponse(response, slug);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -37,6 +39,7 @@ router.get("/status-page", cache("5 minutes"), async (request, response) => {
|
||||||
router.get("/api/status-page/:slug", cache("5 minutes"), async (request, response) => {
|
router.get("/api/status-page/:slug", cache("5 minutes"), async (request, response) => {
|
||||||
allowDevAllOrigin(response);
|
allowDevAllOrigin(response);
|
||||||
let slug = request.params.slug;
|
let slug = request.params.slug;
|
||||||
|
slug = slug.toLowerCase();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Get Status Page
|
// Get Status Page
|
||||||
|
@ -69,6 +72,7 @@ router.get("/api/status-page/heartbeat/:slug", cache("1 minutes"), async (reques
|
||||||
let uptimeList = {};
|
let uptimeList = {};
|
||||||
|
|
||||||
let slug = request.params.slug;
|
let slug = request.params.slug;
|
||||||
|
slug = slug.toLowerCase();
|
||||||
let statusPageID = await StatusPage.slugToID(slug);
|
let statusPageID = await StatusPage.slugToID(slug);
|
||||||
|
|
||||||
let monitorIDList = await R.getCol(`
|
let monitorIDList = await R.getCol(`
|
||||||
|
@ -111,6 +115,7 @@ router.get("/api/status-page/heartbeat/:slug", cache("1 minutes"), async (reques
|
||||||
router.get("/api/status-page/:slug/manifest.json", cache("1440 minutes"), async (request, response) => {
|
router.get("/api/status-page/:slug/manifest.json", cache("1440 minutes"), async (request, response) => {
|
||||||
allowDevAllOrigin(response);
|
allowDevAllOrigin(response);
|
||||||
let slug = request.params.slug;
|
let slug = request.params.slug;
|
||||||
|
slug = slug.toLowerCase();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Get Status Page
|
// Get Status Page
|
||||||
|
@ -145,7 +150,8 @@ router.get("/api/status-page/:slug/manifest.json", cache("1440 minutes"), async
|
||||||
// overall status-page status badge
|
// overall status-page status badge
|
||||||
router.get("/api/status-page/:slug/badge", cache("5 minutes"), async (request, response) => {
|
router.get("/api/status-page/:slug/badge", cache("5 minutes"), async (request, response) => {
|
||||||
allowDevAllOrigin(response);
|
allowDevAllOrigin(response);
|
||||||
const slug = request.params.slug;
|
let slug = request.params.slug;
|
||||||
|
slug = slug.toLowerCase();
|
||||||
const statusPageID = await StatusPage.slugToID(slug);
|
const statusPageID = await StatusPage.slugToID(slug);
|
||||||
const {
|
const {
|
||||||
label,
|
label,
|
||||||
|
|
|
@ -220,13 +220,17 @@ module.exports.statusPageSocketHandler = (socket) => {
|
||||||
|
|
||||||
// Delete groups that are not in the list
|
// Delete groups that are not in the list
|
||||||
log.debug("socket", "Delete groups that are not in the list");
|
log.debug("socket", "Delete groups that are not in the list");
|
||||||
const slots = groupIDList.map(() => "?").join(",");
|
if (groupIDList.length === 0) {
|
||||||
|
await R.exec("DELETE FROM `group` WHERE status_page_id = ?", [ statusPage.id ]);
|
||||||
|
} else {
|
||||||
|
const slots = groupIDList.map(() => "?").join(",");
|
||||||
|
|
||||||
const data = [
|
const data = [
|
||||||
...groupIDList,
|
...groupIDList,
|
||||||
statusPage.id
|
statusPage.id
|
||||||
];
|
];
|
||||||
await R.exec(`DELETE FROM \`group\` WHERE id NOT IN (${slots}) AND status_page_id = ?`, data);
|
await R.exec(`DELETE FROM \`group\` WHERE id NOT IN (${slots}) AND status_page_id = ?`, data);
|
||||||
|
}
|
||||||
|
|
||||||
const server = UptimeKumaServer.getInstance();
|
const server = UptimeKumaServer.getInstance();
|
||||||
|
|
||||||
|
@ -288,6 +292,7 @@ module.exports.statusPageSocketHandler = (socket) => {
|
||||||
ok: true,
|
ok: true,
|
||||||
msg: "successAdded",
|
msg: "successAdded",
|
||||||
msgi18n: true,
|
msgi18n: true,
|
||||||
|
slug: slug
|
||||||
});
|
});
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
|
@ -5,20 +5,20 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="sendgrid-from-email" class="form-label">{{ $t("From Email") }}</label>
|
<label for="sendgrid-from-email" class="form-label">{{ $t("From Email") }}</label>
|
||||||
<input id="sendgrid-from-email" v-model="$parent.notification.sendgridFromEmail" type="email" class="form-control" required>
|
<input id="sendgrid-from-email" v-model="$parent.notification.sendgridFromEmail" type="text" class="form-control" required>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="sendgrid-to-email" class="form-label">{{ $t("To Email") }}</label>
|
<label for="sendgrid-to-email" class="form-label">{{ $t("To Email") }}</label>
|
||||||
<input id="sendgrid-to-email" v-model="$parent.notification.sendgridToEmail" type="email" class="form-control" required>
|
<input id="sendgrid-to-email" v-model="$parent.notification.sendgridToEmail" type="text" class="form-control" required>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="sendgrid-cc-email" class="form-label">{{ $t("smtpCC") }}</label>
|
<label for="sendgrid-cc-email" class="form-label">{{ $t("smtpCC") }}</label>
|
||||||
<input id="sendgrid-cc-email" v-model="$parent.notification.sendgridCcEmail" type="email" class="form-control">
|
<input id="sendgrid-cc-email" v-model="$parent.notification.sendgridCcEmail" type="text" class="form-control">
|
||||||
<div class="form-text">{{ $t("Separate multiple email addresses with commas") }}</div>
|
<div class="form-text">{{ $t("Separate multiple email addresses with commas") }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="sendgrid-bcc-email" class="form-label">{{ $t("smtpBCC") }}</label>
|
<label for="sendgrid-bcc-email" class="form-label">{{ $t("smtpBCC") }}</label>
|
||||||
<input id="sendgrid-bcc-email" v-model="$parent.notification.sendgridBccEmail" type="email" class="form-control">
|
<input id="sendgrid-bcc-email" v-model="$parent.notification.sendgridBccEmail" type="text" class="form-control">
|
||||||
<small class="form-text text-muted">{{ $t("Separate multiple email addresses with commas") }}</small>
|
<small class="form-text text-muted">{{ $t("Separate multiple email addresses with commas") }}</small>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
|
|
|
@ -16,14 +16,11 @@
|
||||||
<label for="slug" class="form-label">{{ $t("Slug") }}</label>
|
<label for="slug" class="form-label">{{ $t("Slug") }}</label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<span id="basic-addon3" class="input-group-text">/status/</span>
|
<span id="basic-addon3" class="input-group-text">/status/</span>
|
||||||
<input id="slug" v-model="slug" type="text" class="form-control" required data-testid="slug-input">
|
<input id="slug" v-model="slug" type="text" class="form-control" autocapitalize="none" required data-testid="slug-input">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-text">
|
<div class="form-text">
|
||||||
<ul>
|
<ul>
|
||||||
<li>{{ $t("Accept characters:") }} <mark>a-z</mark> <mark>0-9</mark> <mark>-</mark></li>
|
<li>{{ $t("Accept characters:") }} <mark>a-z</mark> <mark>0-9</mark> <mark>-</mark></li>
|
||||||
<i18n-t tag="li" keypath="startOrEndWithOnly">
|
|
||||||
<mark>a-z</mark> <mark>0-9</mark>
|
|
||||||
</i18n-t>
|
|
||||||
<li>{{ $t("No consecutive dashes") }} <mark>--</mark></li>
|
<li>{{ $t("No consecutive dashes") }} <mark>--</mark></li>
|
||||||
<i18n-t tag="li" keypath="statusPageSpecialSlugDesc">
|
<i18n-t tag="li" keypath="statusPageSpecialSlugDesc">
|
||||||
<mark class="me-1">default</mark>
|
<mark class="me-1">default</mark>
|
||||||
|
@ -65,7 +62,7 @@ export default {
|
||||||
this.processing = false;
|
this.processing = false;
|
||||||
|
|
||||||
if (res.ok) {
|
if (res.ok) {
|
||||||
location.href = "/status/" + this.slug + "?edit";
|
location.href = "/status/" + res.slug + "?edit";
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (res.msg.includes("UNIQUE constraint")) {
|
if (res.msg.includes("UNIQUE constraint")) {
|
||||||
|
@ -85,4 +82,8 @@ export default {
|
||||||
.shadow-box {
|
.shadow-box {
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#slug {
|
||||||
|
text-transform: lowercase;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -1065,7 +1065,7 @@ import { hostNameRegexPattern } from "../util-frontend";
|
||||||
import HiddenInput from "../components/HiddenInput.vue";
|
import HiddenInput from "../components/HiddenInput.vue";
|
||||||
import EditMonitorConditions from "../components/EditMonitorConditions.vue";
|
import EditMonitorConditions from "../components/EditMonitorConditions.vue";
|
||||||
|
|
||||||
const toast = useToast;
|
const toast = useToast();
|
||||||
|
|
||||||
const pushTokenLength = 32;
|
const pushTokenLength = 32;
|
||||||
|
|
||||||
|
@ -1443,11 +1443,14 @@ message HealthCheckResponse {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.monitor.type === "snmp") {
|
// Set a default timeout if the monitor type has changed or if it's a new monitor
|
||||||
|
if (oldType || this.isAdd) {
|
||||||
|
if (this.monitor.type === "snmp") {
|
||||||
// snmp is not expected to be executed via the internet => we can choose a lower default timeout
|
// snmp is not expected to be executed via the internet => we can choose a lower default timeout
|
||||||
this.monitor.timeout = 5;
|
this.monitor.timeout = 5;
|
||||||
} else {
|
} else {
|
||||||
this.monitor.timeout = 48;
|
this.monitor.timeout = 48;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set default SNMP version
|
// Set default SNMP version
|
||||||
|
|
Loading…
Add table
Reference in a new issue