feat #88 notification blacklist

This commit is contained in:
lyc8503 committed 2025-04-07 00:50:16 +08:00
1 parent 8c818017c1
commit 9bc5deb99d
2 files changed
+12 -2

No files matched your search

+10 -2
View File
@@ -1,6 +1,6 @@
import { workerConfig } from '../../uptime.config'
import { formatStatusChangeNotification, getWorkerLocation, notifyWithApprise } from './util'
import { MonitorState } from '../../uptime.types'
import { MonitorState, MonitorTarget } from '../../uptime.types'
import { getStatus } from './monitor'
export interface Env {
@@ -44,12 +44,20 @@ export default {
// Auxiliary function to format notification and send it via apprise
let formatAndNotify = async (
monitor: any,
monitor: MonitorTarget,
isUp: boolean,
timeIncidentStart: number,
timeNow: number,
reason: string
) => {
// Skip notification if monitor is in the skip list
// @ts-ignore
const skipList: string[] = workerConfig.notification?.skipNotificationIds
if (skipList && skipList.includes(monitor.id)) {
console.log(`Skipping notification for ${monitor.name} (${monitor.id} in skipNotificationIds)`)
return
}
if (workerConfig.notification?.appriseApiServer && workerConfig.notification?.recipientUrl) {
const notification = formatStatusChangeNotification(
monitor,