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))