diff --git a/server/model/rdap-dns.json b/server/model/rdap-dns.json index 51bbe45d3..4412e86f7 100644 --- a/server/model/rdap-dns.json +++ b/server/model/rdap-dns.json @@ -1,9 +1,10 @@ { "description": "RDAP bootstrap file for Domain Name System registrations", - "publication": "2025-12-11T00:00:01Z", + "publication": "2026-01-30T00:00:01Z", "services": [ [["kg"], ["http://rdap.cctld.kg/"]], [["mg"], ["http://rdap.nic.mg/"]], + [["ng"], ["http://rdap.nic.net.ng/"]], [["xn--kpry57d"], ["https://ccrdap.twnic.tw/taiwan/"]], [["tw"], ["https://ccrdap.twnic.tw/tw/"]], [["na"], ["https://keetmans.omadhina.co.na/"]], diff --git a/server/notification-providers/discord.js b/server/notification-providers/discord.js index 21b9e07e4..accc4d2c4 100644 --- a/server/notification-providers/discord.js +++ b/server/notification-providers/discord.js @@ -34,11 +34,23 @@ class Discord extends NotificationProvider { webhookHasAvatar = true; } + const messageFormat = + notification.discordMessageFormat || (notification.discordUseMessageTemplate ? "custom" : "normal"); + // If heartbeatJSON is null, assume we're testing. if (heartbeatJSON == null) { + let content = msg; + if (messageFormat === "minimalist") { + content = "Test: " + msg; + } else if (messageFormat === "custom") { + const customMessage = notification.discordMessageTemplate?.trim() || ""; + if (customMessage !== "") { + content = await this.renderTemplate(customMessage, msg, monitorJSON, heartbeatJSON); + } + } let discordtestdata = { username: discordDisplayName, - content: msg, + content: content, }; if (!webhookHasAvatar) { discordtestdata.avatar_url = "https://github.com/louislam/uptime-kuma/raw/master/public/icon.png"; @@ -55,6 +67,57 @@ class Discord extends NotificationProvider { // If heartbeatJSON is not null, we go into the normal alerting loop. let addess = this.extractAddress(monitorJSON); + + // Minimalist: status + name only (is down / is up; no "back up" — may be first trigger) + if (messageFormat === "minimalist") { + const content = + heartbeatJSON["status"] === DOWN + ? "🔴 " + monitorJSON["name"] + " is down." + : "🟢 " + monitorJSON["name"] + " is up."; + let payload = { + username: discordDisplayName, + content: content, + }; + if (!webhookHasAvatar) { + payload.avatar_url = "https://github.com/louislam/uptime-kuma/raw/master/public/icon.png"; + } + if (notification.discordChannelType === "createNewForumPost") { + payload.thread_name = notification.postName; + } + if (notification.discordSuppressNotifications) { + payload.flags = SUPPRESS_NOTIFICATIONS_FLAG; + } + await axios.post(webhookUrl.toString(), payload, config); + return okMsg; + } + + // Custom template: send only content (no embeds) + const useCustomTemplate = + messageFormat === "custom" && (notification.discordMessageTemplate?.trim() || "") !== ""; + if (useCustomTemplate) { + const content = await this.renderTemplate( + notification.discordMessageTemplate.trim(), + msg, + monitorJSON, + heartbeatJSON + ); + let payload = { + username: discordDisplayName, + content: content, + }; + if (!webhookHasAvatar) { + payload.avatar_url = "https://github.com/louislam/uptime-kuma/raw/master/public/icon.png"; + } + if (notification.discordChannelType === "createNewForumPost") { + payload.thread_name = notification.postName; + } + if (notification.discordSuppressNotifications) { + payload.flags = SUPPRESS_NOTIFICATIONS_FLAG; + } + await axios.post(webhookUrl.toString(), payload, config); + return okMsg; + } + if (heartbeatJSON["status"] === DOWN) { const wentOfflineTimestamp = Math.floor(new Date(heartbeatJSON["time"]).getTime() / 1000); diff --git a/src/components/notifications/Discord.vue b/src/components/notifications/Discord.vue index 6eff2a887..261cf36cd 100644 --- a/src/components/notifications/Discord.vue +++ b/src/components/notifications/Discord.vue @@ -38,6 +38,28 @@ /> +
+ + +
+ +
+
+ + +
{{ $t("discordUseMessageTemplateDescription") }}
+
+
+