From 64ce14f5e29cf874f7b100104a35cfc898dc42ba Mon Sep 17 00:00:00 2001 From: "humingxNobyDaconfig --global user.email 53217160+NobyDa@users.noreply.github.comssh-keygen -t rsa -C humingx@yeah.nethumingx@yeah.net" <53217160+NobyDa@users.noreply.github.com> Date: Tue, 17 Mar 2020 21:05:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E6=8C=81=E4=B9=85=E5=8C=96?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E4=BB=A5=E8=A7=A3=E5=86=B3JsBox=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E6=9B=B4=E6=96=B0=E8=84=9A=E6=9C=ACCookie=E8=A2=AB?= =?UTF-8?q?=E8=A6=86=E7=9B=96=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- JD-DailyBonus/JD_DailyBonus.js | 38 +++++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/JD-DailyBonus/JD_DailyBonus.js b/JD-DailyBonus/JD_DailyBonus.js index 35e3b9d..a0a216e 100644 --- a/JD-DailyBonus/JD_DailyBonus.js +++ b/JD-DailyBonus/JD_DailyBonus.js @@ -1,7 +1,7 @@ /* 京东多合一签到脚本 -更新于: 2020.3.17 11:00 v82 +更新于: 2020.3.17 21:05 v83 有效接口: 22 该脚本同时兼容: QuantumultX, Surge, Loon, JSBox, Node.js @@ -62,8 +62,8 @@ var $nobyda = nobyda(); // 填此处↓↓↓ var Key = ''; //如果使用JSBox或Node.js, 单引号内自行填写您抓取的Cookie. +// 现已加入JsBox持久化接口, 填写Cookie签到成功一次后, 后续JsBox用户更新脚本无需再次填写, 待Cookie失效后再填写即可. -var KEY = Key?Key:$nobyda.read("CookieJD") async function all() {//签到模块相互独立,您可注释某一行以禁用某个接口. await JingDongBean(stop); //京东京豆 await JingRongBean(stop); //金融京豆 @@ -125,10 +125,42 @@ if ($nobyda.isRequest) { GetCookie() $nobyda.done() } else { - all() + ReadCookie() $nobyda.done() } +function ReadCookie() { + return new Promise(resolve => { + if (typeof $app != "undefined") { + var file = $file.exists("shared://JD_Cookie.txt") + if (Key) { + var write = $file.write({ + data: $data({string: Key}), + path: "shared://JD_Cookie.txt" + }) + KEY = Key + all() + } else { + if (file) { + KEY = $file.read("shared://JD_Cookie.txt").string + all() + } else { + $nobyda.notify("京东签到", "", "脚本终止, 未填写Cookie ‼️") + } + } + resolve('done') + } else { + KEY = Key?Key:$nobyda.read("CookieJD") + if (KEY) { + all() + } else { + $nobyda.notify("京东签到", "", "脚本终止, 未获取Cookie ‼️") + } + resolve('done') + } + }); +} + function notify() { return new Promise(resolve => {