feat: 优化规则匹配逻辑,支持通知标题和正文的频道匹配

This commit is contained in:
2025-12-03 17:56:02 +08:00
parent 94c1eac279
commit cf760d4001
2 changed files with 7 additions and 3 deletions

View File

@@ -249,7 +249,10 @@ const matchRule = (notification, rule) => {
if (!rule || rule.enabled === false) return false
const channel = notification?.channel || ''
const text = notification?.text || ''
const channelHit = !rule.channels?.length || rule.channels.some((item) => channel.includes(item))
// 频道命中:优先用通知标题/来源匹配,退而求其次用正文包含匹配(兼容 adb shell / 部分 ROM
const channelHit =
!rule.channels?.length ||
rule.channels.some((item) => channel.includes(item) || text.includes(item))
const keywordHit = !rule.keywords?.length || rule.keywords.some((word) => text.includes(word))
return channelHit && keywordHit
}