mirror of
https://github.com/koichixD/uptime-kuma.git
synced 2026-09-04 09:13:21 +00:00
feat: add customizable matrix notifications (#6899)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
autofix-ci[bot]
parent
2d3048937e
commit
72a5a36541
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"description": "RDAP bootstrap file for Domain Name System registrations",
|
||||
"publication": "2026-02-06T23:00:01Z",
|
||||
"publication": "2026-02-10T00:00:01Z",
|
||||
"services": [
|
||||
[["kg"], ["http://rdap.cctld.kg/"]],
|
||||
[["mg"], ["http://rdap.nic.mg/"]],
|
||||
@@ -62,6 +62,7 @@
|
||||
],
|
||||
[["blog"], ["https://rdap.blog.fury.ca/rdap/"]],
|
||||
[["ca"], ["https://rdap.ca.fury.ca/rdap/"]],
|
||||
[["au"], ["https://rdap.cctld.au/rdap/"]],
|
||||
[["uz"], ["https://rdap.cctld.uz/"]],
|
||||
[["allfinanz"], ["https://rdap.centralnic.com/allfinanz/"]],
|
||||
[["art"], ["https://rdap.centralnic.com/art/"]],
|
||||
|
||||
@@ -32,6 +32,10 @@ class Matrix extends NotificationProvider {
|
||||
body: msg,
|
||||
};
|
||||
|
||||
if (notification.matrixUseTemplate) {
|
||||
data.body = await this.renderTemplate(notification.matrixTemplate, msg, monitorJSON, heartbeatJSON);
|
||||
}
|
||||
|
||||
config = this.getAxiosConfigWithProxy(config);
|
||||
await axios.put(
|
||||
`${notification.homeserverUrl}/_matrix/client/r0/rooms/${roomId}/send/m.room.message/${randomString}`,
|
||||
|
||||
@@ -47,14 +47,50 @@
|
||||
.
|
||||
</i18n-t>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<div class="form-check form-switch">
|
||||
<input v-model="$parent.notification.matrixUseTemplate" class="form-check-input" type="checkbox" />
|
||||
<label class="form-check-label">{{ $t("matrixUseTemplate") }}</label>
|
||||
</div>
|
||||
|
||||
<div class="form-text">
|
||||
{{ $t("matrixUseTemplateDescription") }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<template v-if="$parent.notification.matrixUseTemplate">
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="message_template">{{ $t("Message Template") }}</label>
|
||||
<TemplatedTextarea
|
||||
id="message_template"
|
||||
v-model="$parent.notification.matrixTemplate"
|
||||
:required="true"
|
||||
:placeholder="matrixTemplatedTextareaPlaceholder"
|
||||
></TemplatedTextarea>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import HiddenInput from "../HiddenInput.vue";
|
||||
import TemplatedTextarea from "../TemplatedTextarea.vue";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
HiddenInput,
|
||||
TemplatedTextarea,
|
||||
},
|
||||
computed: {
|
||||
matrixTemplatedTextareaPlaceholder() {
|
||||
return this.$t("Example:", [
|
||||
`
|
||||
Uptime Kuma Alert{% if monitorJSON %} - {{ monitorJSON['name'] }}{% endif %}
|
||||
|
||||
{{ msg }}
|
||||
`,
|
||||
]);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -491,6 +491,8 @@
|
||||
"telegramProtectContentDescription": "If enabled, the bot messages in Telegram will be protected from forwarding and saving.",
|
||||
"telegramUseTemplate": "Use custom message template",
|
||||
"telegramUseTemplateDescription": "If enabled, the message will be sent using a custom template.",
|
||||
"matrixUseTemplate": "Use custom message template",
|
||||
"matrixUseTemplateDescription": "If enabled, the message will be sent using a custom template.",
|
||||
"telegramTemplateFormatDescription": "Telegram allows using different markup languages for messages, see Telegram {0} for specifc details.",
|
||||
"supportTelegramChatID": "Support Direct Chat / Group / Channel's Chat ID",
|
||||
"wayToGetTelegramChatID": "You can get your chat ID by sending a message to the bot and going to this URL to view the chat_id:",
|
||||
|
||||
Reference in New Issue
Block a user