mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-03-13 04:44:46 +00:00
Compare commits
7 commits
27488a17fe
...
4c211382ec
Author | SHA1 | Date | |
---|---|---|---|
|
4c211382ec | ||
|
be2faf64ce | ||
|
0b76e19401 | ||
|
b023a81d7b | ||
|
b84b79b021 | ||
|
b0910138f3 | ||
|
7add28ebd9 |
4 changed files with 30 additions and 5 deletions
|
@ -62,6 +62,7 @@ Requirements:
|
||||||
- Platform
|
- Platform
|
||||||
- ✅ Major Linux distros such as Debian, Ubuntu, CentOS, Fedora and ArchLinux etc.
|
- ✅ Major Linux distros such as Debian, Ubuntu, CentOS, Fedora and ArchLinux etc.
|
||||||
- ✅ Windows 10 (x64), Windows Server 2012 R2 (x64) or higher
|
- ✅ Windows 10 (x64), Windows Server 2012 R2 (x64) or higher
|
||||||
|
- ❌ FreeBSD / OpenBSD / NetBSD
|
||||||
- ❌ Replit / Heroku
|
- ❌ Replit / Heroku
|
||||||
- [Node.js](https://nodejs.org/en/download/) 18 / 20.4
|
- [Node.js](https://nodejs.org/en/download/) 18 / 20.4
|
||||||
- [npm](https://docs.npmjs.com/cli/) 9
|
- [npm](https://docs.npmjs.com/cli/) 9
|
||||||
|
|
|
@ -11,17 +11,22 @@ class DingDing extends NotificationProvider {
|
||||||
*/
|
*/
|
||||||
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
|
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
|
||||||
const okMsg = "Sent Successfully.";
|
const okMsg = "Sent Successfully.";
|
||||||
|
const mentionAll = notification.mentioning === "everyone";
|
||||||
|
const mobileList = notification.mentioning === "specify-mobiles" ? notification.mobileList.split(",") : [];
|
||||||
|
const userList = notification.mentioning === "specify-users" ? notification.userList.split(",") : [];
|
||||||
|
const mentionStr = [ ...mobileList || [], ...userList || [] ].map(item => `@${item}`).join(" ");
|
||||||
try {
|
try {
|
||||||
if (heartbeatJSON != null) {
|
if (heartbeatJSON != null) {
|
||||||
let params = {
|
let params = {
|
||||||
msgtype: "markdown",
|
msgtype: "markdown",
|
||||||
markdown: {
|
markdown: {
|
||||||
title: `[${this.statusToString(heartbeatJSON["status"])}] ${monitorJSON["name"]}`,
|
title: `[${this.statusToString(heartbeatJSON["status"])}] ${monitorJSON["name"]}`,
|
||||||
text: `## [${this.statusToString(heartbeatJSON["status"])}] ${monitorJSON["name"]} \n> ${heartbeatJSON["msg"]}\n> Time (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}`,
|
text: `## [${this.statusToString(heartbeatJSON["status"])}] ${monitorJSON["name"]} \n> ${heartbeatJSON["msg"]}\n> Time (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}${"\n\n" + mentionStr}`,
|
||||||
},
|
},
|
||||||
"at": {
|
at: {
|
||||||
"isAtAll": notification.mentioning === "everyone"
|
isAtAll: mentionAll,
|
||||||
|
atUserIds: userList,
|
||||||
|
atMobiles: mobileList
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (await this.sendToDingDing(notification, params)) {
|
if (await this.sendToDingDing(notification, params)) {
|
||||||
|
@ -31,7 +36,12 @@ class DingDing extends NotificationProvider {
|
||||||
let params = {
|
let params = {
|
||||||
msgtype: "text",
|
msgtype: "text",
|
||||||
text: {
|
text: {
|
||||||
content: msg
|
content: `${msg}${"\n" + mentionStr}`
|
||||||
|
},
|
||||||
|
at: {
|
||||||
|
isAtAll: mentionAll,
|
||||||
|
atUserIds: userList,
|
||||||
|
atMobiles: mobileList
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (await this.sendToDingDing(notification, params)) {
|
if (await this.sendToDingDing(notification, params)) {
|
||||||
|
|
|
@ -19,8 +19,18 @@
|
||||||
<select id="mentioning" v-model="$parent.notification.mentioning" class="form-select" required>
|
<select id="mentioning" v-model="$parent.notification.mentioning" class="form-select" required>
|
||||||
<option value="nobody">{{ $t("Don't mention people") }}</option>
|
<option value="nobody">{{ $t("Don't mention people") }}</option>
|
||||||
<option value="everyone">{{ $t("Mention group", { group: "@everyone" }) }}</option>
|
<option value="everyone">{{ $t("Mention group", { group: "@everyone" }) }}</option>
|
||||||
|
<option value="specify-mobiles">{{ $t("Mention Mobile List") }}</option>
|
||||||
|
<option value="specify-users">{{ $t("Mention User List") }}</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-if="$parent.notification.mentioning === 'specify-mobiles'" class="mb-3">
|
||||||
|
<label for="mobileList" class="form-label">{{ $t("Dingtalk Mobile List") }}<span style="color: red;"><sup>*</sup></span></label>
|
||||||
|
<input id="mobileList" v-model="$parent.notification.mobileList" type="list" class="form-control" required>
|
||||||
|
</div>
|
||||||
|
<div v-if="$parent.notification.mentioning === 'specify-users'" class="mb-3">
|
||||||
|
<label for="userList" class="form-label">{{ $t("Dingtalk User List") }}<span style="color: red;"><sup>*</sup></span></label>
|
||||||
|
<input id="userList" v-model="$parent.notification.userList" type="list" class="form-control" required>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
|
|
@ -687,6 +687,10 @@
|
||||||
"Mentioning": "Mentioning",
|
"Mentioning": "Mentioning",
|
||||||
"Don't mention people": "Don't mention people",
|
"Don't mention people": "Don't mention people",
|
||||||
"Mention group": "Mention {group}",
|
"Mention group": "Mention {group}",
|
||||||
|
"Mention Mobile List": "Mention mobile list",
|
||||||
|
"Mention User List": "Mention user ID List",
|
||||||
|
"Dingtalk Mobile List": "Mobile List (use comma separator)",
|
||||||
|
"Dingtalk User List": "User List (use comma separator)",
|
||||||
"Device Token": "Device Token",
|
"Device Token": "Device Token",
|
||||||
"Platform": "Platform",
|
"Platform": "Platform",
|
||||||
"Huawei": "Huawei",
|
"Huawei": "Huawei",
|
||||||
|
|
Loading…
Add table
Reference in a new issue