From f2f0e3d3369dae7b74c85d9b28f0e4c2d2cdd9c1 Mon Sep 17 00:00:00 2001 From: XXhaos Date: Thu, 30 Apr 2026 13:14:36 +0900 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20Scripts/nodeseek.js?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Scripts/nodeseek.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Scripts/nodeseek.js b/Scripts/nodeseek.js index f92cc0f..621590a 100644 --- a/Scripts/nodeseek.js +++ b/Scripts/nodeseek.js @@ -380,14 +380,30 @@ function ObjectKeys2LowerCase(obj) { } /* ====================== 入口 ====================== */ +const SCRIPT_VERSION = "v3-debug-2026-04-30"; + !(async () => { try { + // 版本标记 + 环境诊断(解决 "cron 误入抓 cookie 分支" 问题用) + $.log(`[VERSION] ${SCRIPT_VERSION}`); + $.log(`[ENV] $request=${typeof $request}, $response=${typeof $response}, $argument=${typeof $argument}`); + if (typeof $request !== "undefined" && $request) { + $.log(`[ENV] $request keys: ${Object.keys($request || {}).join(",")}`); + $.log(`[ENV] $request.url: ${$request.url || ""}`); + } + if (typeof $response !== "undefined" && $response) { + $.log(`[ENV] $response keys: ${Object.keys($response || {}).join(",")}`); + $.log(`[ENV] $response.body length: ${$response.body ? $response.body.length : ""}`); + } + // 判断运行模式: // - http-response 脚本:$response 存在(含 body)→ 抓 cookie // - cron / 手动执行 / Node.js:$response 不存在 → 签到 // 不能用 $request 判断,因为某些 Surge 版本在 cron 里也会注入 $request const isMitmMode = typeof $response !== "undefined" && $response && $response.body; + $.log(`[ENV] isMitmMode=${isMitmMode}`); + if (isMitmMode) { await getCookie(); } else {