From f014defd549c2a858cfe9d9640ca206ebc1f4ca5 Mon Sep 17 00:00:00 2001 From: DrSmoothl <1787882683@qq.com> Date: Tue, 16 Jun 2026 21:54:19 +0800 Subject: [PATCH] feat(notifications): node-config-style channel manager + lock disabled-channel opt-in MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Settings → 通知 now mirrors the node-config UX: info-only channel cards (name / id / url / template + an inline enable toggle), create + edit via a dialog, and all changes debounced-auto-save (no save button). The save path is generation-guarded so a superseded in-flight save can't clobber a newer edit; the test action flushes the pending save first so it never hits an unsaved channel. The channel id is locked while editing to keep per-account channelIds references from orphaning. Per-account opt-in: a globally-disabled channel's toggle is now locked + forced off (it can never fire). The id is kept in channelIds — the backend already filters disabled channels — so re-enabling globally restores the prior selection. New: notification-channel-dialog.tsx. webui typecheck + build green. Adversarial review: 0 blockers / 0 should-fix (2 nits applied). --- .../components/config/notification-opt-in.tsx | 5 +- .../settings/notification-channel-dialog.tsx | 176 ++++++++ .../settings/notifications-panel.tsx | 384 ++++++++++-------- 3 files changed, 390 insertions(+), 175 deletions(-) create mode 100644 packages/webui/src/components/settings/notification-channel-dialog.tsx diff --git a/packages/webui/src/components/config/notification-opt-in.tsx b/packages/webui/src/components/config/notification-opt-in.tsx index 3c472b41..47431c6c 100644 --- a/packages/webui/src/components/config/notification-opt-in.tsx +++ b/packages/webui/src/components/config/notification-opt-in.tsx @@ -71,9 +71,12 @@ export function NotificationOptIn({ selectedIds, onChange }: NotificationOptInPr
{ch.url}
{error}
+ ) : hint ? ( +{hint}
+ ) : null} +
- 账号上线 / 下线时,向启用的渠道 POST 一条渲染后的通知(机械转发,仅去抖防刷屏)。渠道在此全局定义,
- 每个账号在其「配置」页勾选启用哪些。模板变量:
- {'{uin}'} {'{nickname}'}{' '}
- {'{event}'}(offline/online) {'{time}'}。
-
- 下线后在该秒数内自愈则不发(抑制闪断);超时才发「下线」,恢复时再发「上线」。0 表示不去抖、立即发。
-
+ 账号上线 / 下线时向启用的渠道 POST 一条通知(机械转发,仅去抖防刷屏)。渠道在此全局定义,每个账号在其「配置」页勾选启用哪些。 +
+
+ 下线后在该秒数内自愈则不发;超时才发「下线」,恢复时再发「上线」。0 = 立即发、不去抖。
+
- 还没有渠道。点下方「新增渠道」添加一个 webhook。 -
- )} +还没有通知渠道
+ +{msg.text}
} + + {dialog.open && ( +