Compare commits

...

6 commits

Author SHA1 Message Date
Luke Thomas
6118e86a1c
Merge 5b0d17459e into 4228dd0a29 2024-11-19 00:29:48 +00:00
Ionys
4228dd0a29
Fix the timeout value (#5352)
Some checks failed
validate / validate (push) Has been cancelled
Auto Test / armv7-simple-test (18, ARMv7) (push) Has been cancelled
Auto Test / armv7-simple-test (20, ARMv7) (push) Has been cancelled
Auto Test / check-linters (push) Has been cancelled
Auto Test / e2e-test (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
Merge Conflict Labeler / Labeling (push) Has been cancelled
validate / json-yaml-validate (push) Has been cancelled
Auto Test / auto-test (18, ARM64) (push) Has been cancelled
Auto Test / auto-test (18, macos-latest) (push) Has been cancelled
Auto Test / auto-test (18, ubuntu-latest) (push) Has been cancelled
Auto Test / auto-test (18, windows-latest) (push) Has been cancelled
Auto Test / auto-test (20, ARM64) (push) Has been cancelled
Auto Test / auto-test (20, macos-latest) (push) Has been cancelled
Auto Test / auto-test (20, ubuntu-latest) (push) Has been cancelled
Auto Test / auto-test (20, windows-latest) (push) Has been cancelled
2024-11-19 01:29:35 +01:00
Luke Thomas
5b0d17459e Lint 2024-11-11 15:35:37 +00:00
Luke Thomas
ee0f429e8f make slug no longer case sensitive 2024-11-11 14:06:01 +00:00
Luke Thomas
d12d5f94eb style the box to only show lowercase chars, return slug in callback 2024-10-24 10:52:06 +00:00
Luke Thomas
2fb70a037d fix: slug input 2024-10-22 13:02:15 +00:00
4 changed files with 21 additions and 10 deletions

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

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

View file

@ -1443,12 +1443,15 @@ message HealthCheckResponse {
} }
} }
// 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") { 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
if (!this.monitor.snmpVersion) { if (!this.monitor.snmpVersion) {