Skip to content

feat(webhooknotify): add webhook notification plugin - #367

Merged
InfinityPacer merged 1 commit into
mainfrom
codex/feat/webhook-notify
Aug 9, 2026
Merged

feat(webhooknotify): add webhook notification plugin#367
InfinityPacer merged 1 commit into
mainfrom
codex/feat/webhook-notify

Conversation

@InfinityPacer

Copy link
Copy Markdown
Owner

问题与背景

路由、服务器和服务进程等外部监控系统需要把告警发送到 MoviePilot 已配置的通知客户端,但现有 Webhook 入口面向特定事件解析,缺少一个可直接接收通用标题和正文的通知入口。

原因分析

外部监控产生的是通用消息载荷,并不具备 MoviePilot 特定事件结构。直接复用现有事件 Webhook 无法稳定转换为通知,也无法复用通知渠道的消息类型过滤。

解决方案

  • 新增 v2 插件“Webhook消息推送”,提供受 MoviePilot 公共 API_TOKEN 保护的 GETPOST 接口。
  • titlebody 支持任意一项单独传入,并限制最大长度;两项均为空时返回 422
  • 插件默认关闭,消息类型默认使用“插件”;缺失或非法配置同样按“插件”处理。
  • 直接构造 MoviePilot Notification 交给通知链,不设置 sourcelink,由订阅当前消息类型的渠道处理,客户端不生成无关的详情入口。
  • 增加不记录令牌或消息内容的插件日志,并补充插件 README、市场索引和 API 使用说明。
  • pytest.ini 中按固定消息和类别精确过滤 FastAPI/Starlette TestClient 的已知第三方弃用警告,不忽略插件仓自身告警。

影响与风险

  • 插件仅支持 MoviePilot v2,不设置额外的主程序最低版本要求。
  • 不新增插件私有令牌,不涉及数据迁移;新安装保持停用状态。
  • 插件只负责向通知链提交消息,健康检查、故障阈值、重试和去重仍由调用方负责。
  • 实际投递受通知渠道启用状态和消息类型订阅配置影响。
  • warning 过滤仅匹配 starlette.exceptions.StarletteDeprecationWarning 的特定 TestClient 提示。

版本事实

  • 插件 plugin_version1.0
  • package.v2.json 版本与 v1.0 更新记录:已同步
  • 插件 README v1.0 更新日志:已同步
  • 发布标记:release: true

验证

  • .githooks/pre-push:通过
  • python scripts/check_new_plugin_tests.py --base-ref origin/main:通过
  • python -m pytest tests/v2/webhooknotify -q16 passed
  • python tests/run.py -q2225 passed,无 warning
  • python -m json.tool package.v2.jsonpython -m compileall -q plugins.v2/webhooknotifygit diff --check:通过
  • 使用真实启用配置验证 GET、POST 请求均成功进入通知历史并投递到 Telegram,消息未携带 sourcelink

@InfinityPacer
InfinityPacer enabled auto-merge (squash) August 9, 2026 16:36
@InfinityPacer
InfinityPacer merged commit b2a133e into main Aug 9, 2026
3 checks passed
@InfinityPacer
InfinityPacer deleted the codex/feat/webhook-notify branch August 9, 2026 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant