1
0
mirror of https://github.com/louislam/uptime-kuma.git synced 2024-12-20 20:11:39 +02:00

Merge branch 'louislam:master' into master

This commit is contained in:
Jan K. 2024-12-15 13:28:25 +01:00 committed by GitHub
commit ef70ed28db
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 24 additions and 14 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "uptime-kuma", "name": "uptime-kuma",
"version": "2.0.0-dev", "version": "2.0.0-beta.0",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "uptime-kuma", "name": "uptime-kuma",
"version": "2.0.0-dev", "version": "2.0.0-beta.0",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@grpc/grpc-js": "~1.8.22", "@grpc/grpc-js": "~1.8.22",

View File

@ -892,11 +892,13 @@ class Database {
AND important = 0 AND important = 0
AND time < ${sqlHourOffset} AND time < ${sqlHourOffset}
AND id NOT IN ( AND id NOT IN (
SELECT id SELECT id FROM ( -- written this way for Maria's support
FROM heartbeat SELECT id
WHERE monitor_id = ? FROM heartbeat
ORDER BY time DESC WHERE monitor_id = ?
LIMIT ? ORDER BY time DESC
LIMIT ?
) AS limited_ids
) )
`, [ `, [
monitor.id, monitor.id,

View File

@ -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,

View File

@ -292,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) {

View File

@ -619,7 +619,7 @@ $shadow-box-padding: 20px;
bottom: 0; bottom: 0;
margin-left: -$shadow-box-padding; margin-left: -$shadow-box-padding;
margin-right: -$shadow-box-padding; margin-right: -$shadow-box-padding;
z-index: 100; z-index: 10;
background-color: rgba(white, 0.2); background-color: rgba(white, 0.2);
backdrop-filter: blur(2px); backdrop-filter: blur(2px);
border-radius: 0 0 10px 10px; border-radius: 0 0 10px 10px;

View File

@ -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>