From 2fb70a037d8175b9500336a5ffdedd13ad70d505 Mon Sep 17 00:00:00 2001
From: Luke Thomas <96008479+Zoobdude@users.noreply.github.com>
Date: Tue, 22 Oct 2024 13:02:15 +0000
Subject: [PATCH 1/4] fix: slug input
From d12d5f94eb67e1cc5ea026a3ac09b51f7559bbb8 Mon Sep 17 00:00:00 2001
From: Luke Thomas <96008479+Zoobdude@users.noreply.github.com>
Date: Thu, 24 Oct 2024 10:52:06 +0000
Subject: [PATCH 2/4] style the box to only show lowercase chars, return slug
in callback
---
server/socket-handlers/status-page-socket-handler.js | 1 +
src/pages/AddStatusPage.vue | 11 ++++++-----
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/server/socket-handlers/status-page-socket-handler.js b/server/socket-handlers/status-page-socket-handler.js
index 0804da15d..e99886558 100644
--- a/server/socket-handlers/status-page-socket-handler.js
+++ b/server/socket-handlers/status-page-socket-handler.js
@@ -288,6 +288,7 @@ module.exports.statusPageSocketHandler = (socket) => {
ok: true,
msg: "successAdded",
msgi18n: true,
+ slug: slug
});
} catch (error) {
diff --git a/src/pages/AddStatusPage.vue b/src/pages/AddStatusPage.vue
index bae61449c..b35091cc2 100644
--- a/src/pages/AddStatusPage.vue
+++ b/src/pages/AddStatusPage.vue
@@ -16,14 +16,11 @@
/status/
-
+
- {{ $t("Accept characters:") }} a-z 0-9 -
-
- a-z 0-9
-
- {{ $t("No consecutive dashes") }} --
default
@@ -65,7 +62,7 @@ export default {
this.processing = false;
if (res.ok) {
- location.href = "/status/" + this.slug + "?edit";
+ location.href = "/status/" + res.slug + "?edit";
} else {
if (res.msg.includes("UNIQUE constraint")) {
@@ -85,4 +82,8 @@ export default {
.shadow-box {
padding: 20px;
}
+
+#slug {
+ text-transform: lowercase;
+}
From ee0f429e8f3a0b43ba10361801c8bf949f9b0ed3 Mon Sep 17 00:00:00 2001
From: Luke Thomas <96008479+Zoobdude@users.noreply.github.com>
Date: Mon, 11 Nov 2024 14:06:01 +0000
Subject: [PATCH 3/4] make slug no longer case sensitive
---
server/routers/status-page-router.js | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/server/routers/status-page-router.js b/server/routers/status-page-router.js
index b209d33d1..412662003 100644
--- a/server/routers/status-page-router.js
+++ b/server/routers/status-page-router.js
@@ -15,11 +15,13 @@ const server = UptimeKumaServer.getInstance();
router.get("/status/:slug", cache("5 minutes"), async (request, response) => {
let slug = request.params.slug;
+ slug = slug.toLowerCase();
await StatusPage.handleStatusPageResponse(response, server.indexHTML, slug);
});
router.get("/status/:slug/rss", cache("5 minutes"), async (request, response) => {
let slug = request.params.slug;
+ slug = slug.toLowerCase();
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) => {
allowDevAllOrigin(response);
let slug = request.params.slug;
+ slug = slug.toLowerCase();
try {
// Get Status Page
@@ -69,6 +72,7 @@ router.get("/api/status-page/heartbeat/:slug", cache("1 minutes"), async (reques
let uptimeList = {};
let slug = request.params.slug;
+ slug = slug.toLowerCase();
let statusPageID = await StatusPage.slugToID(slug);
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) => {
allowDevAllOrigin(response);
let slug = request.params.slug;
+ slug = slug.toLowerCase();
try {
// Get Status Page
@@ -146,6 +151,7 @@ router.get("/api/status-page/:slug/manifest.json", cache("1440 minutes"), async
router.get("/api/status-page/:slug/badge", cache("5 minutes"), async (request, response) => {
allowDevAllOrigin(response);
const slug = request.params.slug;
+ slug = slug.toLowerCase();
const statusPageID = await StatusPage.slugToID(slug);
const {
label,
From 5b0d17459eaf061c41e607febead08b95aba95ec Mon Sep 17 00:00:00 2001
From: Luke Thomas <96008479+Zoobdude@users.noreply.github.com>
Date: Mon, 11 Nov 2024 15:35:37 +0000
Subject: [PATCH 4/4] Lint
---
server/routers/status-page-router.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/server/routers/status-page-router.js b/server/routers/status-page-router.js
index 412662003..893f57564 100644
--- a/server/routers/status-page-router.js
+++ b/server/routers/status-page-router.js
@@ -150,7 +150,7 @@ router.get("/api/status-page/:slug/manifest.json", cache("1440 minutes"), async
// overall status-page status badge
router.get("/api/status-page/:slug/badge", cache("5 minutes"), async (request, response) => {
allowDevAllOrigin(response);
- const slug = request.params.slug;
+ let slug = request.params.slug;
slug = slug.toLowerCase();
const statusPageID = await StatusPage.slugToID(slug);
const {