feat(webhooknotify): add webhook notification plugin - #367
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题与背景
路由、服务器和服务进程等外部监控系统需要把告警发送到 MoviePilot 已配置的通知客户端,但现有 Webhook 入口面向特定事件解析,缺少一个可直接接收通用标题和正文的通知入口。
原因分析
外部监控产生的是通用消息载荷,并不具备 MoviePilot 特定事件结构。直接复用现有事件 Webhook 无法稳定转换为通知,也无法复用通知渠道的消息类型过滤。
解决方案
API_TOKEN保护的GET、POST接口。title和body支持任意一项单独传入,并限制最大长度;两项均为空时返回422。Notification交给通知链,不设置source和link,由订阅当前消息类型的渠道处理,客户端不生成无关的详情入口。pytest.ini中按固定消息和类别精确过滤 FastAPI/Starlette TestClient 的已知第三方弃用警告,不忽略插件仓自身告警。影响与风险
starlette.exceptions.StarletteDeprecationWarning的特定 TestClient 提示。版本事实
plugin_version:1.0package.v2.json版本与v1.0更新记录:已同步v1.0更新日志:已同步release: true验证
.githooks/pre-push:通过python scripts/check_new_plugin_tests.py --base-ref origin/main:通过python -m pytest tests/v2/webhooknotify -q:16 passedpython tests/run.py -q:2225 passed,无 warningpython -m json.tool package.v2.json、python -m compileall -q plugins.v2/webhooknotify、git diff --check:通过source或link