Skip to content

新增飞书群机器人与 Discord 渠道,移除 NotifyX 与 Gotify - #132

Merged
todosdev[bot] merged 2 commits into
mainfrom
tds/conv-01a158ae-fbda-7f82-8d53-90b3aee12f97
Oct 20, 2026
Merged

todosdev[bot] merged 2 commits into
mainfrom
tds/conv-01a158ae-fbda-7f82-8d53-90b3aee12f97

Conversation

@todosdev

@todosdev todosdev Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • 新增两个通知渠道:飞书群机器人(feishu,同时兼容国内版 open.feishu.cn 与国际版 open.larksuite.com)和 Discord(discord),渠道总数保持 8 个。
  • 移除 Gotify 与 NotifyX 的全部发送代码、注册、类型与前端文案;存量库的两列配置保留休眠,enabled_channels 中的残留 ID 由既有清理迁移一并剔除。
  • 顺带修正老条目中残留退役渠道导致无法保存的问题:渠道选择器会把未知 ID 显示为可移除的 chip。

Changes

新增发送器(worker/src/services/notify/)

  • feishu.ts:双域名 + /open-apis/bot/v2/hook/ 路径白名单,走 validateOutboundUrl、redirect: "manual"、safeErrorText;开启签名校验时按官方算法(key = ${timestamp}\n${secret}、空消息、HMAC-SHA256 + Base64)生成 sign;解析返回体,code 非 0 判失败并带回 msg,不打印配置或请求体。
  • discord.ts:仅接受 discord.com / discordapp.com 且路径以 /api/webhooks/ 开头;**标题** + 正文 + 可选 URL,按码点截断到 2000 字符;仅 HTTP 200/204 判成功,429 不自动重试。

注册与存储

  • notify/index.ts、types.ts:注册 feishu/discord,删除 gotify/notifyx;VALID_CHANNELS 与 NotificationConfig 同步。
  • lib/setup.ts:新增 feishu_config、discord_config 加列迁移(PRAGMA table_info 查列、缺则 ALTER);退役清理迁移的过滤集合扩为 serverchan、pushplus、gotify、notifyx,保持幂等与坏行跳过;getSchema() 与 schema.sql 两处建表定义同步删旧列、加新列。
  • db/queries/notifications.ts:配置列白名单替换为两个新列。
  • routes/me.ts:两份敏感字段子串名单各补 "secret",保证飞书签名密钥读取时打码、回传占位符时不覆盖真实值。

前端

  • lib/channels.ts、pages/channels/ChannelPage.tsx:渠道列表与配置表单换为 feishu(webhook_url + 可选 secret)与 discord(webhook_url)。
  • components/ChannelSelector.tsx:已选但不在渠道列表中的退役 ID 不再被静默丢弃,而是渲染为带 Retired channel 提示的可移除 chip——否则这类老条目保存必然被后端 400 拒绝。
  • locales/zh.json、locales/en.json:渠道名键替换(飞书群机器人 / Feishu Bot、Discord)。

文档

  • README.md、README.en.md、CLAUDE.md:渠道名单同步为最终 8 个。

Testing

  • pnpm typecheck、pnpm build、pnpm format:check 通过;pnpm test 6 个测试文件 54 个用例全绿(本机 pnpm 包装器异常,用其 pnpm.mjs 直调并加 PATH shim 执行)。
  • 新增 worker/test/feishu.test.ts、worker/test/discord.test.ts:签名与 node:crypto 离线期望值一致、双域名/路径白名单、业务 code 非 0 判失败、200/204 与 429/500 判定、2000 码点截断不切坏代理对。
  • 扩写 worker/test/migrations.test.ts:老库加列与默认值、既有数据不变、gotify_config/notifyx_config 休眠保留、四渠道清理保序与幂等、全新安装列集合、清理后不再产生 Unknown channel 历史。
  • 未做的验证:真实发送需用户提供飞书/Lark 机器人与 Discord Webhook 地址人工验收;部署后需管理员手动触发一次设置流程(设置页或 POST /api/admin/setup),加列与清理才生效。

@todosdev
todosdev Bot merged commit a4fe5e8 into main Oct 20, 2026
1 check passed
@mapxn
mapxn deleted the tds/conv-01a158ae-fbda-7f82-8d53-90b3aee12f97 branch November 8, 2026 11:29
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.

0 participants