From fafa1a78ee0bfd9445ddeb073851acbbc562d1be Mon Sep 17 00:00:00 2001 From: darkclip Date: Fri, 1 Nov 2024 14:58:06 +0800 Subject: [PATCH] use extractAddress() instead of monitorJSON["url"] for better url handling --- server/notification-providers/wecom.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/server/notification-providers/wecom.js b/server/notification-providers/wecom.js index 2b509c8a9..529baa1b2 100644 --- a/server/notification-providers/wecom.js +++ b/server/notification-providers/wecom.js @@ -36,6 +36,7 @@ class WeCom extends NotificationProvider { * @returns {object} Message */ composeMessage(heartbeatJSON, monitorJSON, msg) { + const address = this.extractAddress(monitorJSON); if (heartbeatJSON != null) { const templateCard = { card_type: "text_notice", @@ -58,16 +59,16 @@ class WeCom extends NotificationProvider { ], card_action: { type: 1, - url: monitorJSON["url"] - ? monitorJSON["url"] + url: address + ? address : "https://github.com/louislam/uptime-kuma", // both card_action and card_action.url are mandatory }, }; - if (monitorJSON["url"]) { + if (address) { templateCard["jump_list"] = [ { type: 1, - url: monitorJSON["url"], + url: address, title: "Monitor URL", }, ];