Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: redesign notification module #513

Open
wants to merge 51 commits into
base: 3.2-dev
Choose a base branch
from

Conversation

100gle
Copy link
Contributor

@100gle 100gle commented Oct 4, 2023

ISSUE: #427
社区现有的第三方实现:notifiers

TODOs

  • 统一通知服务接口实现 NotifierAdapter
    • 提供两种消息通知方法:
      • 异步发送(aiohttp)
      • 同步发送(虽然是同步写法,但用 ThreadPoolExecutor 来实现非阻塞转发)
    • 通知消息类型:
      • Bangumi Notification
      • 日志 Record 类型
      • 其他文本类型(用于测试等用途)
    • 支持多种通知服务:
      • telegram
      • slack
      • wecom
      • server 酱
      • gotify
      • bark
  • 实现 Logging 模块的 handler 方法以便集成日志模块
  • 通知服务配置
    • 后端:配置类型适配
    • 前端:
      • 服务配置字段 UI 修改
      • UI 设置区域「测试发送通知」按钮
  • 消息通知 API
    • 技术方案备选:
      1. 使用 SQLite 作为消息队列(可用第三方库:litequeue):无额外依赖,但不具消息订阅和发布功能,最终实现的通知效果可能不如预期的及时,本质上就是 CRUD + 轮询
      2. MQTT(可用第三方库:fastapi-mqtt):方案较为成熟,MQTT 面向的是 IoT 场景,非常轻量化,不过需要额外预装 eclipse-mosquitto 作为 Broker,Docker 镜像体积在 13MB 左右)
    • 发布消息通知(在日志或剧集更新时调用了发送方法后作为回调触发)
    • 提供对应的消息数量统计 API
    • 提供对应的消息清除 API
    • 提供消息通知分页
  • 自定义 Webhook([WIP] feat: add notification webhook #571
  • WebUI
    • 右上角添加通知和未读
      • 轮询未读消息接口
      • 默认展示最近的 10 条
    • 通知消息展示页面
      • 通知消息分页
      • 已阅某N条通知按钮

@vercel
Copy link

vercel bot commented Oct 4, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
auto-bangumi ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 13, 2023 2:10pm

@100gle
Copy link
Contributor Author

100gle commented Oct 12, 2023

cc @EstrellaXD @Rewrite0, ready for reviewing.

Copy link
Collaborator

@Rewrite0 Rewrite0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

大致看了下, 周六再仔细看看吧

webui/src/api/notification.ts Outdated Show resolved Hide resolved
webui/src/components/setting/config-notification.vue Outdated Show resolved Hide resolved
webui/src/hooks/useNotificaiton.ts Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: [v3.2] In progress
3 participants