From 3ce29ebee26ca67fe76d7e6e4ee73108afb770c8 Mon Sep 17 00:00:00 2001 From: zhuhjay Date: Thu, 5 Nov 2026 20:21:02 +0800 Subject: [PATCH] =?UTF-8?q?docs(notify):=20=E8=AF=8A=E6=96=AD=E8=A1=A5?= =?UTF-8?q?=E7=AC=AC=205b=20=E8=8A=82=EF=BC=8C=E6=8C=87=E5=90=91=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0=E4=BE=A7=E7=9A=84=E8=BD=AC=E5=8F=91=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 用户实跑结果:sendNotify 加载正常、WEBHOOK 三项前置条件全过、 直打平台两次都 204(含换行/中文/emoji 的完整正文也收下了)。 但 PUSH_PLUS_TOKEN 未设 —— 青龙根本不发 pushplus,所以收到的那条 pushplus 一定来自平台转发,不是脚本自己发的。 补第 5b 节把这条推理写进输出: - 204 只证明平台收下了,收到 ≠ 转发 - 中间还有两道门:事件要匹配到账号、账号下要有 enabled+active 的 pushplus 目标 - 给出两个 curl 判据(/api/notify-targets 与 /api/events?category=notify) 以及 deliveries=N 的读法 - 第 5 节在 PUSH_PLUS_TOKEN 未设时不再只是「跳过」,而是说明 这条消息必然是平台转发来的 --- scrip_diag_notify.js | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/scrip_diag_notify.js b/scrip_diag_notify.js index 59a44ad..cfb2514 100644 --- a/scrip_diag_notify.js +++ b/scrip_diag_notify.js @@ -194,7 +194,10 @@ if (!WU) { hr('5. 直连 pushplus(模板对比)') const PT = process.env.PUSH_PLUS_TOKEN || '' if (!PT) { - console.log(' · PUSH_PLUS_TOKEN 未设,跳过') + console.log(' · PUSH_PLUS_TOKEN 未设 —— 青龙侧不发 pushplus') + console.log(' · 若你收到过 pushplus 消息,那是平台(script-helper)转发来的') + console.log(' → 说明平台侧的通知目标配好了,问题只在「正文被折叠」') + console.log(' → 平台用 template=txt(不折叠),青龙 sendNotify 用 html(折叠)') } else { for (const tpl of ['txt', 'html']) { const content = tpl === 'html' ? DESP.replace(/\n/g, '
') : DESP @@ -212,6 +215,28 @@ if (!WU) { console.log(' · 两条都收不到 → PUSH_PLUS_TOKEN 或实名状态有问题') } + /* ────────── 5b. 平台侧有没有把事件转发出去 ────────── */ + hr('5b. 平台侧转发检查') + const base = (() => { try { const u = new URL(finalUrl); return `${u.protocol}//${u.host}` } catch { return '' } })() + console.log(' 平台基址:', base || '(无法从 WEBHOOK_URL 推出)') + console.log('') + console.log(' 第 4 节是 204,说明平台「收下了」。但收到 ≠ 转发,中间还有两道门:') + console.log(' ① 事件要匹配到你的账号(notify_events.user_id 非空,或走 owner 原文透传)') + console.log(' ② 你的账号下要有 enabled=1 且 status=active 的 pushplus 目标') + console.log('') + console.log(' 验证方式(浏览器登录平台后打开开发者工具,或用 curl 带 cookie):') + if (base) { + console.log(` curl -s "${base}/api/notify-targets" -H "cookie: <你的会话 cookie>"`) + console.log(' → items 为空 = 没有目标,平台收到也不会转发(这就是只收到标题的原因)') + console.log(` curl -s "${base}/api/events?category=notify&limit=10" -H "cookie: <你的会话 cookie>"`) + console.log(' → 能看到 action=notify.send 的记录,message 里 deliveries=N') + console.log(' → deliveries=0 表示匹配到了事件但没有任何目标可投') + } + console.log('') + console.log(' 一句话判据:') + console.log(' · 平台 /api/notify-targets 为空 → 去平台「通知」页新建一个 pushplus 目标') + console.log(' · 有目标但 events 里 deliveries=0 → 目标被禁用,或事件没匹配到账号') + /* ────────── 6. 走一遍完整 sendNotify ────────── */ hr('6. 完整 sendNotify') if (!sn) { @@ -222,6 +247,7 @@ if (!WU) { console.log('\n 对照第 4 节:') console.log(' · 若这里出现「自定义发送通知消息失败」但第 4 节是 204 → 假警报,投递成功') console.log(' · 若第 4 节 401/403 → webhook 头或 IP 的问题,与 sendNotify 无关') + console.log(' · 已修版本会打「成功🎉 HTTP 204」;仍打失败说明仓库还没更新到这个版本') } hr('完成') })().catch(e => console.log(' 异常:', e.message))