Compare commits

...

5 commits

Author SHA1 Message Date
Nathan Neulinger
921a8a6eb0
Merge a8a8dcf134 into 7dc6191b0a 2025-01-24 17:49:47 +00:00
Nathan Neulinger
a8a8dcf134 remove unused 2024-12-27 14:49:25 -06:00
Nathan Neulinger
0492276601 clean up lint complaints 2024-12-27 14:46:41 -06:00
Nathan Neulinger
61629cd963 Add description 2024-12-27 14:34:18 -06:00
Nathan Neulinger
afd0ae6428 Initial support for setting a server identifier 2024-12-27 14:21:18 -06:00
10 changed files with 68 additions and 9 deletions

5
package-lock.json generated
View file

@ -1,12 +1,12 @@
{
"name": "uptime-kuma",
"version": "2.0.0-beta.0",
"version": "2.0.0-beta.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "uptime-kuma",
"version": "2.0.0-beta.0",
"version": "2.0.0-beta.1",
"license": "MIT",
"dependencies": {
"@grpc/grpc-js": "~1.8.22",
@ -8332,7 +8332,6 @@
"integrity": "sha512-3/CE4aJX7LNEiE3i6FeodHmI/38GZtWCsAtsymScmzYapx8q1nVVb+eLcLSzATmCPXw5pT4TqVs1E0OmxAd9tw==",
"deprecated": "This version is no longer supported. Please see https://eslint.org/version-support for other options.",
"dev": true,
"license": "MIT",
"dependencies": {
"@eslint/eslintrc": "^1.2.2",
"@humanwhocodes/config-array": "^0.9.2",

View file

@ -160,6 +160,7 @@ async function sendInfo(socket, hideVersion = false) {
isContainer,
dbType,
primaryBaseURL: await setting("primaryBaseURL"),
serverIdentifier: await setting("serverIdentifier"),
serverTimezone: await server.getTimezone(),
serverTimezoneOffset: server.getTimezoneOffset(),
});

View file

@ -142,8 +142,12 @@ class Slack extends NotificationProvider {
}
const baseURL = await setting("primaryBaseURL");
const serverIdentifier = await setting("serverIdentifier");
const title = "Uptime Kuma Alert";
let title = "Uptime Kuma Alert";
if (serverIdentifier) {
title = title + " (" + serverIdentifier + ")";
}
let data = {
"channel": notification.slackchannel,
"username": notification.slackusername,

View file

@ -1,5 +1,6 @@
const nodemailer = require("nodemailer");
const NotificationProvider = require("./notification-provider");
const { setting } = require("../util-server");
const { DOWN } = require("../../src/util");
const { Liquid } = require("liquidjs");
@ -46,6 +47,11 @@ class SMTP extends NotificationProvider {
let body = msg;
if (heartbeatJSON) {
body = `${msg}\nTime (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}`;
const serverIdentifier = await setting("serverIdentifier");
if (serverIdentifier) {
body = body + `\nServer Identifier: ${serverIdentifier}`;
}
}
// subject and body are templated
if ((monitorJSON && heartbeatJSON) || msg.endsWith("Testing")) {

View file

@ -132,6 +132,29 @@
<div class="form-text"></div>
</div>
<!-- Server Identifier -->
<div class="mb-4">
<label class="form-label" for="serverIdentifier">
{{ $t("Server Identifier") }}
</label>
<div class="input-group mb-3">
<input
id="serverIdentifier"
v-model="settings.serverIdentifier"
class="form-control"
name="serverIdentifier"
placeholder=""
pattern=".+"
autocomplete="new-password"
/>
</div>
<div class="form-text">
{{ $t("serverIdentifierDescription") }}
</div>
</div>
<!-- Steam API Key -->
<div class="mb-4">
<label class="form-label" for="steamAPIKey">

View file

@ -16,6 +16,8 @@
"General": "General",
"Game": "Game",
"Primary Base URL": "Primary Base URL",
"serverIdentifier": "Server Identifier",
"serverIdentifierDescription": "If provided, this will be appended in parentheses after Uptime Kuma in UI and notifications",
"Version": "Version",
"Check Update On GitHub": "Check Update On GitHub",
"List": "List",

View file

@ -13,7 +13,7 @@
<header v-if="! $root.isMobile" class="d-flex flex-wrap justify-content-center py-3 mb-3 border-bottom">
<router-link to="/dashboard" class="d-flex align-items-center mb-3 mb-md-0 me-md-auto text-dark text-decoration-none">
<object class="bi me-2 ms-4" width="40" height="40" data="/icon.svg" />
<span class="fs-4 title">{{ $t("Uptime Kuma") }}</span>
<span class="fs-4 title">{{ $t("Uptime Kuma") }}{{ $root.serverIdentifierSuffix }}</span>
</router-link>
<a v-if="hasNewVersion" target="_blank" href="https://github.com/louislam/uptime-kuma/releases" class="btn btn-info me-3">
@ -85,7 +85,7 @@
<header v-else class="d-flex flex-wrap justify-content-center pt-2 pb-2 mb-3">
<router-link to="/dashboard" class="d-flex align-items-center text-dark text-decoration-none">
<object class="bi" width="40" height="40" data="/icon.svg" />
<span class="fs-4 title ms-2">Uptime Kuma</span>
<span class="fs-4 title ms-2">{{ $t("Uptime Kuma") }}{{ $root.serverIdentifierSuffix }}</span>
</router-link>
</header>
@ -170,7 +170,11 @@ export default {
},
watch: {
$route(to) {
if (this.serverIdentifierSuffix) {
this.updateTitle("Uptime Kuma" + this.$root.serverIdentifierSuffix);
}
}
},
mounted() {
@ -188,6 +192,10 @@ export default {
if (this.toastContainer != null) {
this.toastContainerObserver.observe(this.toastContainer, { childList: true });
}
if (this.$root.serverIdentifierSuffix) {
this.updateTitle("Uptime Kuma" + this.$root.serverIdentifierSuffix);
}
},
beforeUnmount() {
@ -201,6 +209,10 @@ export default {
*/
clearToasts() {
toast.clear();
},
updateTitle(title) {
document.title = title;
}
},

View file

@ -51,5 +51,17 @@ export default {
return location.protocol + "//" + location.host;
}
},
serverIdentifierSuffix() {
if (this.$root.info.serverIdentifier) {
return " (" + this.$root.info.serverIdentifier + ")";
}
if (env === "development" || localStorage.dev === "dev") {
return " (dev)";
} else {
return "";
}
},
}
};

View file

@ -5,7 +5,7 @@
<div>
<object width="64" height="64" data="/icon.svg" />
<div style="font-size: 28px; font-weight: bold; margin-top: 5px;">
Uptime Kuma
{{ $t("Uptime Kuma") }}
</div>
</div>

View file

@ -4,7 +4,7 @@
<div>
<object width="64" height="64" data="/icon.svg" />
<div style="font-size: 28px; font-weight: bold; margin-top: 5px;">
Uptime Kuma
{{ $t("Uptime Kuma") }}
</div>
</div>