mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-27 08:44:04 +00:00
use extractAddress() instead of monitorJSON["url"] for better url handling
This commit is contained in:
parent
c70ec1ea50
commit
fafa1a78ee
1 changed files with 5 additions and 4 deletions
|
@ -36,6 +36,7 @@ class WeCom extends NotificationProvider {
|
||||||
* @returns {object} Message
|
* @returns {object} Message
|
||||||
*/
|
*/
|
||||||
composeMessage(heartbeatJSON, monitorJSON, msg) {
|
composeMessage(heartbeatJSON, monitorJSON, msg) {
|
||||||
|
const address = this.extractAddress(monitorJSON);
|
||||||
if (heartbeatJSON != null) {
|
if (heartbeatJSON != null) {
|
||||||
const templateCard = {
|
const templateCard = {
|
||||||
card_type: "text_notice",
|
card_type: "text_notice",
|
||||||
|
@ -58,16 +59,16 @@ class WeCom extends NotificationProvider {
|
||||||
],
|
],
|
||||||
card_action: {
|
card_action: {
|
||||||
type: 1,
|
type: 1,
|
||||||
url: monitorJSON["url"]
|
url: address
|
||||||
? monitorJSON["url"]
|
? address
|
||||||
: "https://github.com/louislam/uptime-kuma", // both card_action and card_action.url are mandatory
|
: "https://github.com/louislam/uptime-kuma", // both card_action and card_action.url are mandatory
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
if (monitorJSON["url"]) {
|
if (address) {
|
||||||
templateCard["jump_list"] = [
|
templateCard["jump_list"] = [
|
||||||
{
|
{
|
||||||
type: 1,
|
type: 1,
|
||||||
url: monitorJSON["url"],
|
url: address,
|
||||||
title: "Monitor URL",
|
title: "Monitor URL",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
Loading…
Reference in a new issue