From c0598ac606ac5a6bc58fe90ae88520ab3177c928 Mon Sep 17 00:00:00 2001 From: Damon <604821528@qq.com> Date: Thu, 29 May 2025 19:54:07 +0800 Subject: [PATCH] Flashduty IntegrationKey support Endpoint URL (#5859) --- server/notification-providers/flashduty.js | 4 ++-- src/components/notifications/FlashDuty.vue | 8 +++++--- src/lang/en.json | 4 +++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/server/notification-providers/flashduty.js b/server/notification-providers/flashduty.js index c340ed06f..bac6f07ca 100644 --- a/server/notification-providers/flashduty.js +++ b/server/notification-providers/flashduty.js @@ -73,13 +73,13 @@ class FlashDuty extends NotificationProvider { } const options = { method: "POST", - url: "https://api.flashcat.cloud/event/push/alert/standard?integration_key=" + notification.flashdutyIntegrationKey, + url: notification.flashdutyIntegrationKey.startsWith("http") ? notification.flashdutyIntegrationKey : "https://api.flashcat.cloud/event/push/alert/standard?integration_key=" + notification.flashdutyIntegrationKey, headers: { "Content-Type": "application/json" }, data: { description: `[${title}] [${monitorInfo.name}] ${body}`, title, event_status: eventStatus || "Info", - alert_key: String(monitorInfo.id) || Math.random().toString(36).substring(7), + alert_key: monitorInfo.id ? String(monitorInfo.id) : Math.random().toString(36).substring(7), labels, } }; diff --git a/src/components/notifications/FlashDuty.vue b/src/components/notifications/FlashDuty.vue index a66ada013..5f61c2b84 100644 --- a/src/components/notifications/FlashDuty.vue +++ b/src/components/notifications/FlashDuty.vue @@ -1,7 +1,10 @@