From 6416673949e95b7b225dac7f357f2ec9f0d1776f Mon Sep 17 00:00:00 2001 From: XXhaos Date: Thu, 30 Apr 2026 10:09:15 +0900 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E8=87=B3?= =?UTF-8?q?=E3=80=8CScripts=E3=80=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Scripts/nodeseek.js | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/Scripts/nodeseek.js b/Scripts/nodeseek.js index df57f98..3836e7a 100644 --- a/Scripts/nodeseek.js +++ b/Scripts/nodeseek.js @@ -17,18 +17,12 @@ * - MITM 模式:访问 nodeseek 个人主页时自动抓取 cookie * - Cron 模式:定时执行签到 * - * 配置项(持久化存储 / 环境变量): + * 配置项(优先级:$argument > 持久化存储 > 环境变量): * - nodeseek_data 账号数组(脚本自动写入,无需手动配置) * - nodeseek_default "false"=固定鸡腿(默认) / "true"=随机鸡腿 * - is_debug "true"=输出详细日志(cookie 已脱敏) * - * 重写规则(替换 /): - * - * [Script] - * http-response ^https:\/\/www\.nodeseek\.com\/api\/account\/getInfo\/.+\?readme=1&signature=1&phone=1 script-path=https://gitea.dragonisheep.com/XXhaos/Surge/raw/branch/master/Scripts/nodeseek.js, requires-body=true, timeout=60, tag=NodeSeek获取token - * - * [MITM] - * hostname = www.nodeseek.com + * 推荐部署:使用配套的 nodeseek.sgmodule 模块文件。 * * ⚠️ 仅供学习研究,使用前请阅读原作者免责声明。 * ============================================================ @@ -66,10 +60,32 @@ $.userList = []; $.notifyMsg = []; const notify = $.isNode() ? require("./sendNotify") : null; + +// 解析 Surge 模块 $argument(形如 "is_default=false&is_debug=false") +const moduleArgs = (() => { + const result = {}; + if (typeof $argument === "undefined" || !$argument) return result; + String($argument) + .split("&") + .forEach((pair) => { + const idx = pair.indexOf("="); + if (idx <= 0) return; + const k = pair.slice(0, idx).trim(); + const v = pair.slice(idx + 1).trim(); + if (k) result[k] = v; + }); + return result; +})(); + +// 配置读取优先级:$argument > 持久化存储 / 环境变量 > 默认值 $.is_debug = - ($.isNode() ? process.env.IS_DEBUG : $.getdata("is_debug")) || "false"; + moduleArgs.is_debug || + ($.isNode() ? process.env.IS_DEBUG : $.getdata("is_debug")) || + "false"; $.is_default = - ($.isNode() ? process.env["nodeseek_default"] : $.getdata("nodeseek_default")) || "false"; + moduleArgs.is_default || + ($.isNode() ? process.env["nodeseek_default"] : $.getdata("nodeseek_default")) || + "false"; /* ====================== 工具函数 ====================== */