luci-app-jd-dailybonus: Keep up to date from jerrykuku (#6537)

This commit is contained in:
Beginner 2021-03-15 13:19:30 +08:00 committed by GitHub
parent f06ba13bd2
commit 54e90134e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 168 additions and 252 deletions

View File

@ -12,12 +12,9 @@ o = s:option(DummyValue, '', '')
o.rawhtml = true
o.template = 'jd-dailybonus/cookie_tools'
o = s:option(Value, 'cookie', translate('第一账号Cookie'))
o = s:option(DynamicList, "Cookies", translate("账号 Cookie 列表"))
o.rmempty = false
o = s:option(Value, 'cookie2', translate('第二账号Cookie'))
o.rmempty = true
o = s:option(Value, 'stop', translate('延迟签到'))
o.rmempty = false
o.default = 0
@ -90,7 +87,6 @@ o:value('https://raw.githubusercontent.com/NobyDa/Script/master/JD-DailyBonus/JD
o:value('https://raw.sevencdn.com/NobyDa/Script/master/JD-DailyBonus/JD_DailyBonus.js', translate('GitHub CDN 01'))
o:value('https://cdn.jsdelivr.net/gh/NobyDa/Script/JD-DailyBonus/JD_DailyBonus.js', translate('GitHub CDN 02'))
o:value('https://ghproxy.com/https://raw.githubusercontent.com/NobyDa/Script/master/JD-DailyBonus/JD_DailyBonus.js', translate('韩国首尔'))
o:value('https://gitee.com/jerrykuku/staff/raw/master/JD_DailyBonus.js', translate('Gitee'))
o.default = 'nil'
o.rmempty = false
o.description = translate('当GitHub源无法更新时,可以选择使用国内Gitee源,GitHub CDN可能比原地址更晚更新但速度快')

View File

@ -65,17 +65,6 @@
padding: 1rem 0 0 0;
}
</style>
<label class="cbi-value-title"><%= translate("获取Cookie") %></label>
<div class="cbi-value-field">
<input type="button" data-rel="1" class="cbi-button cbi-input-reload cookie-button" value="<%= translate('获取第一Cookie') %>" />
<input type="button" data-rel="2" class="cbi-button cbi-input-reload cookie-button" value="<%= translate('获取第二Cookie') %>" />
<br />
<div class="cbi-value-description">
<span class="cbi-value-helpicon"><img src="/luci-static/resources/cbi/help.gif" alt="帮助" /></span>
<%= translate("点击上面按钮使用京东手机app扫码获取Cookie")%>
</div>
</div>
<div id="qrcontainer" class="hidden">
<div class="qframe">
<div id="refresh_qrcode" class="hidden">
@ -96,19 +85,20 @@
let ckid = 0;
//初始化二维码
let cookieBtn = Array.prototype.slice.call(document.getElementsByClassName("cookie-button"));
try {
qrcode = new QRCode(document.getElementById("qrcode"),
{
text: "sample",
correctLevel: QRCode.CorrectLevel.L
});
cookieBtn.forEach(e => {
e.onclick = () => {
ckid = e.getAttribute("data-rel");
get_code();
return false;
}
$(document).ready(function(){
$("div[id$='-Cookies']").dblclick(function ( e ) {
if ( e.target.className == "cbi-input-text" ) {
var index = $(e.target).attr("id");
ckid = index.substring(index.indexOf(".Cookies") + 9);
get_code();
}
});
});
} catch (error) {
alert("网络离线状态无法使用二维码获取Cookie请刷新后重试")
@ -130,23 +120,23 @@
}
function checkLogin(check_url){
let cname = ckid == 1?"cookie":"cookie2"
XHR.poll(3, CHECK_LOGIN_URL, { check_url: check_url, id: cname }, (x, d) => {
if (d.error == 0) {
XHR.halt();
XHR._q = [];
document.getElementById("qrcontainer").classList.add("hidden");
document.getElementById("refresh_qrcode").classList.add("hidden");
let prefix_array = document.getElementsByClassName("cbi-input-text")[0].getAttribute("id").split(".")
prefix_array.pop()
let id = `${prefix_array.join(".")}.${cname}`;
document.getElementById(id).value = d.cookie
} else if (d.error == 21 || d.error == 261) {
XHR.halt();
XHR._q = [];
document.getElementById("refresh_qrcode").classList.remove("hidden");
}
});
var timeId = setInterval(() => {
let cname = "cookie" + ckid
jQuery.post( CHECK_LOGIN_URL, { check_url:check_url,id: cname}, function( data ) {
if (data.error == 0) {
clearInterval(timeId)
$("#qrcontainer").addClass("hidden")
$("#refresh_qrcode").addClass("hidden")
let prefix_array = $(".cbi-input-text").eq(0).attr("id").split(".");
prefix_array.pop()
let prefix = prefix_array.join(".")+".";
document.getElementById(prefix+ckid).value =data.cookie
} else if (data.error == 21 || data.error == 261) {
clearInterval(timeId)
$("#refresh_qrcode").removeClass("hidden")
}
}, "json");
}, 3000)
}
</script>

View File

@ -1,5 +1,5 @@
config global
option version '1.90'
option version '1.96'
option out '0'
option stop '100'
option serverchan ''
@ -11,4 +11,4 @@ config global
option auto_run_time '0'
option auto_run_time_m '1'
option auto_run_time_h '1'
option cookie ''
list Cookies '双击扫码添加 Cookie 数据'

View File

@ -2,8 +2,8 @@
京东多合一签到脚本
更新时间: 2021.01.28 18:40 v1.92
有效接口: 40+
更新时间: 2021.02.28 18:30 v1.96
有效接口: 35+
脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js
电报频道: @NobyDa
问题反馈: @NobyDa_bot
@ -19,6 +19,8 @@ var Key = ''; //单引号内自行填写您抓取的Cookie
var DualKey = ''; //如需双账号签到,此处单引号内填写抓取的"账号2"Cookie, 否则请勿填写
var OtherKey = ''; //第三账号或以上的Cookie json串数据, 以下样例为第三第四账号var OtherKey = '[{"cookie":"pt_key=xxxxxx;pt_pin=yyyyyy"},{"cookie":"pt_key=xxxxxx;pt_pin=yyyyyy"}]'
/* 1: JsBoxNode.js, 使QX,Surge,Loon, 使Cookie.
注2: 双账号用户抓取"账号1"Cookie后, 请勿点击退出账号(可能会导致Cookie失效), 需清除浏览器资料或更换浏览器登录"账号2"抓取.
注3: 如果复制的Cookie开头为"Cookie: "请把它删除后填入.
@ -35,16 +37,15 @@ var DualKey = ''; //如需双账号签到,此处单引号内填写抓取的"账
由于cookie的有效性(经测试网页Cookie有效周期最长31天)如果脚本后续弹出cookie无效的通知则需要重复上述步骤
签到脚本将在每天的凌晨0:05执行, 您可以修改执行时间 因部分接口京豆限量领取, 建议调整为凌晨签到
BoxJs订阅地址: https://raw.githubusercontent.com/NobyDa/Script/master/NobyDa_BoxJs.json
BoxJs或QX Gallery订阅地址: https://raw.githubusercontent.com/NobyDa/Script/master/NobyDa_BoxJs.json
*************************
配置京东账号签到说明 :
配置京东账号签到说明 :
*************************
正确配置QXSurgeLoon后, 并使用此脚本获取"账号1"Cookie成功后, 请勿点击退出账号(可能会导致Cookie失效), 需清除浏览器资料或更换浏览器登录"账号2"获取即可.
正确配置QXSurgeLoon后, 并使用此脚本获取"账号1"Cookie成功后, 请勿点击退出账号(可能会导致Cookie失效), 需清除浏览器资料或更换浏览器登录"账号2"获取即可; 账号3或以上同理.
: 如需清除所有Cookie, 您可开启脚本内"DeleteCookie"选项 (第96行)
: 获取"账号1""账号2"的Cookie后, 后续仅可更新该"账号1""账号2"的Cookie.
如需写入其他账号,您可开启脚本内"DeleteCookie"选项以清除Cookie
*************************
Surge 4.2+ 脚本配置:
*************************
@ -76,7 +77,7 @@ hostname = api.m.jd.com
[task_local]
# 京东多合一签到
# 注意此为远程路径, 低版本用户请自行调整为本地路径.
5 0 * * * https://raw.githubusercontent.com/NobyDa/Script/master/JD-DailyBonus/JD_DailyBonus.js, tag=京东多合一签到, img-url=https://raw.githubusercontent.com/Orz-3/task/master/jd.png,enabled=true
5 0 * * * https://raw.githubusercontent.com/NobyDa/Script/master/JD-DailyBonus/JD_DailyBonus.js, tag=京东多合一签到, img-url=https://raw.githubusercontent.com/NobyDa/mini/master/Color/jd.png,enabled=true
[rewrite_local]
# 获取京东Cookie.
@ -92,7 +93,7 @@ var LogDetails = false; //是否开启响应日志, true则开启
var stop = '0'; //自定义延迟签到, 单位毫秒. 默认分批并发无延迟; 该参数接受随机或指定延迟(例: '2000'则表示延迟2秒; '2000-5000'则表示延迟最小2秒,最大5秒内的随机延迟), 如填入延迟则切换顺序签到(耗时较长), Surge用户请注意在SurgeUI界面调整脚本超时; 注: 该参数Node.js或JSbox环境下已配置数据持久化, 留空(var stop = '')即可清除.
var DeleteCookie = false; //是否清除Cookie, true则开启.
var DeleteCookie = false; //是否清除所有Cookie, true则开启.
var boxdis = true; //是否开启自动禁用, false则关闭. 脚本运行崩溃时(如VPN断连), 下次运行时将自动禁用相关崩溃接口(仅部分接口启用), 崩溃时可能会误禁用正常接口. (该选项仅适用于QX,Surge,Loon)
@ -109,8 +110,6 @@ async function all() {
await Promise.all([
JingDongBean(stop), //京东京豆
JingDongStore(stop), //京东超市
JingDongWebcasts(stop), //京东直播
JingRongBean(stop), //金融简单赚钱
JingRongSteel(stop), //金融钢镚
JingDongTurn(stop), //京东转盘
JDFlashSale(stop), //京东闪购
@ -121,7 +120,7 @@ async function all() {
JingDongShake(stop), //京东摇一摇
JDSecKilling(stop), //京东秒杀
JRLuckyLottery(stop), //金融抽奖顶部签到
JingDongBuyCar(stop, '319fd268c5df469192d9420a2de4d8d2'), //京东汽车
JingDongBuyCar(stop, '31dd4ebdcad341b79e36cb7c29095de9'), //京东汽车
JingRongDoll(stop, 'JRDoll', '京东金融-签壹', '4D25A6F482'),
JingRongDoll(stop, 'JRTwoDoll', '京东金融-签贰', '3A3E839252'),
JingRongDoll(stop, 'JRThreeDoll', '京东金融-签叁', '69F5EC743C'),
@ -129,28 +128,25 @@ async function all() {
JingRongDoll(stop, 'JRFiveDoll', '京东金融-签伍', '1D06AA3B0F')
]);
await Promise.all([
JDUserSignPre(stop, 'JDCustomized', '京东商城-定制', 'RPordkuhnM4MzR24fLWgc8YRbXJ'), //京东定制
JDUserSignPre(stop, 'JDShoes', '京东商城-鞋靴', '4RXyb1W4Y986LJW8ToqMK14BdTD'), //京东鞋靴
JDUserSignPre(stop, 'JDCalendar', '京东日历-翻牌', '36V2Qw59VPNsuLxY84vCFtxFzrFs'), //京东日历翻牌
JDUserSignPre(stop, 'JDChild', '京东商城-童装', '3Af6mZNcf5m795T8dtDVfDwWVNhJ'), //京东童装馆
JDUserSignPre(stop, 'JDBaby', '京东商城-母婴', '3BbAVGQPDd6vTyHYjmAutXrKAos6'), //京东母婴馆
JDUserSignPre(stop, 'JD3C', '京东商城-数码', '4SWjnZSCTHPYjE5T7j35rxxuMTb6'), //京东数码电器馆
// JDUserSignPre(stop, 'JDSubsidy', '京东晚市-补贴', 'xK148m4kWj5hBcTPuJUNNXH3AkJ'), //京东晚市补贴金
JDUserSignPre(stop, 'JDWomen', '京东商城-女装', 'DpSh7ma8JV7QAxSE2gJNro8Q2h9'), //京东女装馆
JDUserSignPre(stop, 'JDFineWine', '京东商城-酒饮', 'zGwAUzL3pVGjptBBGeYfpKjYdtX'), //京东酒饮馆
JDUserSignPre(stop, 'JDBook', '京东商城-图书', '3SC6rw5iBg66qrXPGmZMqFDwcyXi'), //京东图书
JingRongDoll(stop, 'JTDouble', '京东金贴-双签', '1DF13833F7'), //京东金融 金贴双签
JingRongDoll(stop, 'XJDouble', '金融现金-双签', 'F68B2C3E71', '', '', '', 'xianjin') //京东金融 现金双签
]);
await Promise.all([
JDUserSignPre(stop, 'JDClothing', '京东商城-服饰', '4RBT3H9jmgYg1k2kBnHF8NAHm7m8'), //京东服饰
JDUserSignPre(stop, 'JDUnderwear', '京东商城-内衣', '4PgpL1xqPSW1sVXCJ3xopDbB1f69'), //京东内衣馆
JDUserSignPre(stop, 'JDSuitcase', '京东商城-箱包', 'ZrH7gGAcEkY2gH8wXqyAPoQgk6t'), //京东箱包馆
JDUserSignPre(stop, 'JDSchool', '京东商城-校园', '2QUxWHx5BSCNtnBDjtt5gZTq7zdZ'), //京东校园
JDUserSignPre(stop, 'JDHealth', '京东商城-健康', 'w2oeK5yLdHqHvwef7SMMy4PL8LF'), //京东健康
// JDUserSignPre(stop, 'JDPet', '京东商城-宠物', '37ta5sh5ocrMZF3Fz5UMJbTsL42'), //京东宠物馆
JDUserSignPre(stop, 'JDShand', '京东拍拍-二手', '3S28janPLYmtFxypu37AYAGgivfp'), //京东拍拍二手
JDUserSignPre(stop, 'JDClean', '京东商城-清洁', '2Tjm6ay1ZbZ3v7UbriTj6kHy9dn6'), //京东清洁馆
JDUserSignPre(stop, 'JDCare', '京东商城-个护', 'NJ1kd1PJWhwvhtim73VPsD1HwY3'), //京东个人护理馆
JDUserSignPre(stop, 'JDCare', '京东商城-个护', '2tZssTgnQsiUqhmg5ooLSHY9XSeN'), //京东个人护理馆
JDUserSignPre(stop, 'JDJewels', '京东商城-珠宝', 'zHUHpTHNTaztSRfNBFNVZscyFZU'), //京东珠宝馆
// JDUserSignPre(stop, 'JDClocks', '京东商城-钟表', '2BcJPCVVzMEtMUynXkPscCSsx68W'), //京东钟表馆
JDUserSignPre(stop, 'JDMakeup', '京东商城-美妆', '2smCxzLNuam5L14zNJHYu43ovbAP'), //京东美妆馆
@ -162,8 +158,6 @@ async function all() {
default:
await JingDongBean(0); //京东京豆
await JingDongStore(Wait(stop)); //京东超市
await JingDongWebcasts(Wait(stop)); //京东直播
await JingRongBean(Wait(stop)); //金融简单赚钱
await JingRongSteel(Wait(stop)); //金融钢镚
await JingDongTurn(Wait(stop)); //京东转盘
await JDFlashSale(Wait(stop)); //京东闪购
@ -174,7 +168,7 @@ async function all() {
await JingDongShake(Wait(stop)); //京东摇一摇
await JDSecKilling(Wait(stop)); //京东秒杀
await JRLuckyLottery(Wait(stop)); //金融抽奖顶部签到
await JingDongBuyCar(Wait(stop), '319fd268c5df469192d9420a2de4d8d2'); //京东汽车
await JingDongBuyCar(Wait(stop), '31dd4ebdcad341b79e36cb7c29095de9'); //京东汽车
await JingRongDoll(Wait(stop), 'JRTwoDoll', '京东金融-签贰', '3A3E839252');
await JingRongDoll(Wait(stop), 'JRThreeDoll', '京东金融-签叁', '69F5EC743C');
await JingRongDoll(Wait(stop), 'JRFourDoll', '京东金融-签肆', '30C4F86264');
@ -182,7 +176,7 @@ async function all() {
await JingRongDoll(Wait(stop), 'JRDoll', '京东金融-签壹', '4D25A6F482');
await JingRongDoll(Wait(stop), 'XJDouble', '金融现金-双签', 'F68B2C3E71', '', '', '', 'xianjin'); //京东金融 现金双签
await JingRongDoll(Wait(stop), 'JTDouble', '京东金贴-双签', '1DF13833F7'); //京东金融 金贴双签
await JDUserSignPre(Wait(stop), 'JDUnderwear', '京东商城-内衣', '4PgpL1xqPSW1sVXCJ3xopDbB1f69'); //京东内衣馆
await JDUserSignPre(Wait(stop), 'JDCustomized', '京东商城-定制', 'RPordkuhnM4MzR24fLWgc8YRbXJ'); //京东定制
await JDUserSignPre(Wait(stop), 'JDSuitcase', '京东商城-箱包', 'ZrH7gGAcEkY2gH8wXqyAPoQgk6t'); //京东箱包馆
await JDUserSignPre(Wait(stop), 'JDClothing', '京东商城-服饰', '4RBT3H9jmgYg1k2kBnHF8NAHm7m8'); //京东服饰
await JDUserSignPre(Wait(stop), 'JDSchool', '京东商城-校园', '2QUxWHx5BSCNtnBDjtt5gZTq7zdZ'); //京东校园
@ -192,17 +186,14 @@ async function all() {
await JDUserSignPre(Wait(stop), 'JDChild', '京东商城-童装', '3Af6mZNcf5m795T8dtDVfDwWVNhJ'); //京东童装馆
await JDUserSignPre(Wait(stop), 'JDBaby', '京东商城-母婴', '3BbAVGQPDd6vTyHYjmAutXrKAos6'); //京东母婴馆
await JDUserSignPre(Wait(stop), 'JD3C', '京东商城-数码', '4SWjnZSCTHPYjE5T7j35rxxuMTb6'); //京东数码电器馆
// await JDUserSignPre(Wait(stop), 'JDSubsidy', '京东晚市-补贴', 'xK148m4kWj5hBcTPuJUNNXH3AkJ'); //京东晚市补贴金
// await JDUserSignPre(Wait(stop), 'JDClocks', '京东商城-钟表', '2BcJPCVVzMEtMUynXkPscCSsx68W'); //京东钟表馆
await JDUserSignPre(Wait(stop), 'JDWomen', '京东商城-女装', 'DpSh7ma8JV7QAxSE2gJNro8Q2h9'); //京东女装馆
// await JDUserSignPre(Wait(stop), 'JDPet', '京东商城-宠物', '37ta5sh5ocrMZF3Fz5UMJbTsL42'); //京东宠物馆
await JDUserSignPre(Wait(stop), 'JDBook', '京东商城-图书', '3SC6rw5iBg66qrXPGmZMqFDwcyXi'); //京东图书
await JDUserSignPre(Wait(stop), 'JDShand', '京东拍拍-二手', '3S28janPLYmtFxypu37AYAGgivfp'); //京东拍拍二手
await JDUserSignPre(Wait(stop), 'JDMakeup', '京东商城-美妆', '2smCxzLNuam5L14zNJHYu43ovbAP'); //京东美妆馆
await JDUserSignPre(Wait(stop), 'JDFineWine', '京东商城-酒饮', 'zGwAUzL3pVGjptBBGeYfpKjYdtX'); //京东酒饮馆
await JDUserSignPre(Wait(stop), 'JDVege', '京东商城-菜场', 'Wcu2LVCFMkBP3HraRvb7pgSpt64'); //京东菜场
await JDUserSignPre(Wait(stop), 'JDClean', '京东商城-清洁', '2Tjm6ay1ZbZ3v7UbriTj6kHy9dn6'); //京东清洁馆
await JDUserSignPre(Wait(stop), 'JDCare', '京东商城-个护', 'NJ1kd1PJWhwvhtim73VPsD1HwY3'); //京东个人护理馆
await JDUserSignPre(Wait(stop), 'JDCare', '京东商城-个护', '2tZssTgnQsiUqhmg5ooLSHY9XSeN'); //京东个人护理馆
await JDUserSignPre(Wait(stop), 'JDJewels', '京东商城-珠宝', 'zHUHpTHNTaztSRfNBFNVZscyFZU'); //京东珠宝馆
await JingRongDoll(Wait(stop), 'JDDouble', '金融京豆-双签', 'F68B2C3E71', '', '', '', 'jingdou'); //京东金融 京豆双签
await JingDongSpeedUp(Wait(stop)); //京东天天加速
@ -260,29 +251,20 @@ function notify() {
var four = `【账号总计】: ${beans+Steel}${beans||Steel?`\n`:`获取失败\n`}`
var five = `【其他总计】: ${Subsidy+Money+Cash}${Subsidy||Money||Cash?`\n`:`获取失败\n`}`
var DName = merge.TotalBean && merge.TotalBean.nickname ? merge.TotalBean.nickname : "获取失败"
var Name = add ? DualAccount ? `【签到号一】: ${DName}\n` : `【签到号二】: ${DName}\n` : ""
var cnNum = ["零", "一", "二", "三", "四", "五", "六", "七", "八", "九", "十"];
const numFix = !Key && !DualKey ? DualAccount - 2 : Key && DualKey ? DualAccount : DualAccount - 1 || DualAccount
const Name = DualKey || OtherKey ? `【签到号${cnNum[numFix]||numFix}】: ${DName}\n` : ``
const disables = $nobyda.read("JD_DailyBonusDisables")
const amount = disables ? disables.split(",").length : 0
const disa = !notify || amount ? `【温馨提示】: 检测到${$nobyda.disable?`上次执行意外崩溃, `:``}已禁用${notify?`${amount}`:`所有`}接口, 如需开启请前往BoxJs或查看脚本内第99行注释.\n` : ``
const disa = !notify || amount ? `【温馨提示】: 检测到${$nobyda.disable?`上次执行意外崩溃, `:``}已禁用${notify?`${amount}`:`所有`}接口, 如需开启请前往BoxJs或查看脚本内第100行注释.\n` : ``
$nobyda.notify("", "", Name + one + two + three + four + five + disa + notify, {
'media-url': $nobyda.headUrl || 'https://cdn.jsdelivr.net/gh/Orz-3/task@master/jd.png'
'media-url': $nobyda.headUrl || 'https://cdn.jsdelivr.net/gh/NobyDa/mini@master/Color/jd.png'
});
$nobyda.headUrl = null;
if ($nobyda.isJSBox) {
if (add && DualAccount) {
Shortcut = Name + one + two + three + "\n"
} else if (!add && DualAccount) {
$intents.finish(Name + one + two + three + four + five + notify)
} else if (typeof Shortcut != "undefined") {
$intents.finish(Shortcut + Name + one + two + three)
}
}
if (DualAccount) {
double();
} else {
$nobyda.time();
$nobyda.done();
Shortcut = (typeof(Shortcut) == 'undefined' ? '' : Shortcut) + Name + one + two + three + four + five + "\n"
}
double();
} catch (eor) {
$nobyda.notify("通知模块 " + eor.name + "‼️", JSON.stringify(eor), eor.message)
} finally {
@ -292,13 +274,15 @@ function notify() {
}
function ReadCookie() {
DualAccount = true;
DualAccount = 1;
const EnvInfo = $nobyda.isJSBox ? "JD_Cookie" : "CookieJD"
const EnvInfo2 = $nobyda.isJSBox ? "JD_Cookie2" : "CookieJD2"
const EnvInfo3 = $nobyda.isJSBox ? "JD_Cookies" : "CookiesJD"
if (DeleteCookie) {
if ($nobyda.read(EnvInfo) || $nobyda.read(EnvInfo2)) {
if ($nobyda.read(EnvInfo) || $nobyda.read(EnvInfo2) || ($nobyda.read(EnvInfo3) || '[]') != '[]') {
$nobyda.write("", EnvInfo)
$nobyda.write("", EnvInfo2)
$nobyda.write("", EnvInfo3)
$nobyda.notify("京东Cookie清除成功 !", "", '请手动关闭脚本内"DeleteCookie"选项')
$nobyda.done()
return
@ -310,20 +294,27 @@ function ReadCookie() {
GetCookie()
return
}
if (Key || $nobyda.read(EnvInfo)) {
Key = Key || $nobyda.read(EnvInfo)
DualKey = DualKey || $nobyda.read(EnvInfo2)
OtherKey = OtherKey || $nobyda.read(EnvInfo3)
KEY = Key || DualKey
if (KEY || OtherKey) {
if ($nobyda.isJSBox || $nobyda.isNode) {
if (Key) $nobyda.write(Key, EnvInfo);
if (DualKey) $nobyda.write(DualKey, EnvInfo2);
if (OtherKey) $nobyda.write(OtherKey, EnvInfo3);
if (stop !== '0') $nobyda.write(stop, "JD_DailyBonusDelay");
}
add = DualKey || $nobyda.read(EnvInfo2) ? true : false
KEY = Key ? Key : $nobyda.read(EnvInfo)
out = parseInt($nobyda.read("JD_DailyBonusTimeOut")) || out
stop = Wait($nobyda.read("JD_DailyBonusDelay"), true) || Wait(stop, true)
boxdis = $nobyda.read("JD_Crash_disable") === "false" || $nobyda.isNode || $nobyda.isJSBox ? false : boxdis
LogDetails = $nobyda.read("JD_DailyBonusLog") === "true" || LogDetails
ReDis = ReDis ? $nobyda.write("", "JD_DailyBonusDisables") : ""
all()
if (KEY) {
all()
} else {
double()
}
} else {
$nobyda.notify("京东签到", "", "脚本终止, 未获取Cookie ‼️")
$nobyda.done()
@ -331,12 +322,30 @@ function ReadCookie() {
}
function double() {
add = true
DualAccount = false
if (DualKey || $nobyda.read($nobyda.isJSBox ? "JD_Cookie2" : "CookieJD2")) {
KEY = DualKey ? DualKey : $nobyda.read($nobyda.isJSBox ? "JD_Cookie2" : "CookieJD2")
KEY = '';
if (DualAccount == 1) {
DualAccount++;
KEY = Key ? DualKey : ''
}
if (!KEY && OtherKey) {
DualAccount++;
let cks = [];
try {
cks = JSON.parse(OtherKey);
} catch (e) {
cks = [];
console.log(`\n第三及以上账号Cookie读取失败, 请检查Json格式.`)
}
if (cks.length + 2 >= DualAccount) {
KEY = cks[DualAccount - 3].cookie;
}
}
if (KEY) {
all()
} else {
if ($nobyda.isJSBox) {
$intents.finish(Shortcut)
}
$nobyda.time();
$nobyda.done();
}
@ -506,95 +515,6 @@ function JingDongTurnSign(s, code) {
});
}
function JingRongBean(s) {
merge.JRBean = {};
return new Promise(resolve => {
if (disable("JRBean")) return resolve()
setTimeout(() => {
const login = {
url: 'https://ms.jr.jd.com/gw/generic/zc/h5/m/queryOpenScreenReward',
headers: {
Cookie: KEY
},
body: "reqData=%7B%22channelCode%22%3A%22ZHUANQIAN%22%2C%22clientType%22%3A%22sms%22%2C%22clientVersion%22%3A%2211.0%22%7D"
};
$nobyda.post(login, async function(error, response, data) {
try {
if (error) {
throw new Error(error)
} else {
const Details = LogDetails ? "response:\n" + data : '';
if (data.match(/\"login\":true/)) {
console.log("\n" + "京东金融-金贴查询成功 " + Details)
const cc = JSON.parse(data)
if (cc.resultData.data.reward === false) {
await JRBeanCheckin(s, cc.resultData.data.rewardAmount);
} else {
const tp = cc.resultData.data.reward === true
merge.JRBean.notify = `京东金融-金贴: 失败, 原因: ${tp?`已签过`:`未知`} ⚠️`
merge.JRBean.fail = 1
}
} else {
console.log("\n" + "京东金融-金贴查询失败 " + Details)
const lt = data.match(/\"login\":false/)
merge.JRBean.fail = 1
merge.JRBean.notify = `京东金融-金贴: 失败, 原因: ${lt?`Cookie失效‼`:`未知 ⚠️`}`
}
}
} catch (eor) {
$nobyda.AnError("金融金贴-查询", "JRBean", eor, response, data)
} finally {
resolve()
}
})
}, s)
if (out) setTimeout(resolve, out + s)
});
}
function JRBeanCheckin(s, amount) {
return new Promise(resolve => {
setTimeout(() => {
const JRBUrl = {
url: 'https://ms.jr.jd.com/gw/generic/zc/h5/m/openScreenReward',
headers: {
Cookie: KEY
},
body: "reqData=%7B%22channelCode%22%3A%22ZHUANQIAN%22%2C%22clientType%22%3A%22sms%22%2C%22clientVersion%22%3A%2211.0%22%7D"
};
$nobyda.post(JRBUrl, function(error, response, data) {
try {
if (error) {
throw new Error(error)
} else {
const Details = LogDetails ? "response:\n" + data : '';
if (data.match(/\"rewardCode\":\"00000\"/)) {
console.log("\n" + "京东金融-金贴签到成功 " + Details)
merge.JRBean.subsidy = amount || 0
merge.JRBean.notify = `京东金融-金贴: 成功, 明细: ${amount || ``}金贴 💰`
merge.JRBean.success = 1
} else {
console.log("\n" + "京东金融-金贴签到失败 " + Details)
merge.JRBean.fail = 1
if (data.match(/发放失败|70111|10000|60203/)) {
merge.JRBean.notify = "京东金融-金贴: 失败, 原因: 已签过 ⚠️"
} else {
const UnType = data.match(/\"resultCode\":3|请先登录/)
merge.JRBean.notify = `京东金融-金贴: 失败, 原因: ${UnType?`Cookie失效‼`:`未知 ⚠️`}`
}
}
}
} catch (eor) {
$nobyda.AnError("京东金融-金贴", "JRBean", eor, response, data)
} finally {
resolve()
}
})
}, s)
if (out) setTimeout(resolve, out + s)
});
}
function JingRongSteel(s) {
merge.JRSteel = {};
return new Promise(resolve => {
@ -1741,44 +1661,6 @@ function JingDongGetCash(s) {
});
}
function JingDongWebcasts(s) {
merge.JDWebcasts = {};
return new Promise(resolve => {
if (disable("JDWebcasts")) return resolve()
setTimeout(() => {
$nobyda.get({
url: `https://api.m.jd.com/api?functionId=getChannelTaskRewardToM&appid=h5-live&body=%7B%22type%22%3A%22signTask%22%2C%22itemId%22%3A%221%22%7D`,
headers: {
Cookie: KEY,
Origin: `https://h.m.jd.com`
}
}, (error, response, data) => {
try {
if (error) throw new Error(error)
const cc = JSON.parse(data);
const Details = LogDetails ? "response:\n" + data : '';
if (cc.code == 0 && cc.subCode == 0) {
console.log(`\n京东商城-直播签到成功 ${Details}`)
merge.JDWebcasts.bean = cc.sum || 0
merge.JDWebcasts.success = 1
merge.JDWebcasts.notify = `京东商城-直播: 成功, 明细: ${merge.JDWebcasts.bean||``}京豆 🐶`
} else {
console.log(`\n京东商城-直播签到失败 ${Details}`)
const tp = data.match(/擦肩而过/) ? `无机会` : cc.code == 3 ? `Cookie失效` : `${cc.msg||`未知`}`
merge.JDWebcasts.notify = `京东商城-直播: 失败, 原因: ${tp}${cc.code==3?`‼️`:` ⚠️`}`
merge.JDWebcasts.fail = 1
}
} catch (eor) {
$nobyda.AnError("京东商城-直播", "JDWebcasts", eor, response, data)
} finally {
resolve()
}
})
}, s)
if (out) setTimeout(resolve, out + s)
});
}
function JingDongStore(s) {
merge.JDGStore = {};
return new Promise(resolve => {
@ -2205,36 +2087,49 @@ function Wait(readDelay, ini) {
function GetCookie() {
try {
if ($request.headers && $request.url.match(/api\.m\.jd\.com.*=signBean/)) {
var CV = $request.headers['Cookie']
if (CV.match(/pt_key=.+?;/) && CV.match(/pt_pin=.+?;/)) {
var CookieValue = CV.match(/pt_key=.+?;/)[0] + CV.match(/pt_pin=.+?;/)[0]
var CK1 = $nobyda.read("CookieJD")
var CK2 = $nobyda.read("CookieJD2")
var AccountOne = CK1 ? CK1.match(/pt_pin=.+?;/) ? CK1.match(/pt_pin=(.+?);/)[1] : null : null
var AccountTwo = CK2 ? CK2.match(/pt_pin=.+?;/) ? CK2.match(/pt_pin=(.+?);/)[1] : null : null
var UserName = CookieValue.match(/pt_pin=(.+?);/)[1]
var DecodeName = decodeURIComponent(UserName)
if (!AccountOne || UserName == AccountOne) {
var CookieName = " [账号一] ";
var CookieKey = "CookieJD";
} else if (!AccountTwo || UserName == AccountTwo) {
var CookieName = " [账号二] ";
var CookieKey = "CookieJD2";
} else {
$nobyda.notify("更新京东Cookie失败", "非历史写入账号 ‼️", '请开启脚本内"DeleteCookie"以清空Cookie ‼️')
return
}
} else {
if ($request.method != 'OPTIONS' && $request.headers && $request.url !== 'http://www.apple.com/') {
let acObj = {};
// 提取ck数据
let CV = ($request.headers['Cookie'] || $request.headers['cookie'] || '').replace(/ /g, '');
let ckItems = CV.split(';').filter(s => /^(pt_key|pt_pin)=.+/.test(s)).sort();
if (ckItems.length == 2) {
acObj.cookie = ckItems.join(';') + ';';
acObj.userName = decodeURIComponent(acObj.cookie.match(/pt_pin=(.+?);/)[1]);
}
// 无cookie数据进行提示有ck数据找到账号位进行存储
if (!acObj.cookie) {
$nobyda.notify("写入京东Cookie失败", "", "请查看脚本内说明, 登录网页获取 ‼️")
return
}
const RA = $nobyda.read(CookieKey);
if (RA == CookieValue) {
console.log(`\n用户名: ${DecodeName}\n与历史京东${CookieName}Cookie相同, 跳过写入 ⚠️`)
} else {
const WT = $nobyda.write(CookieValue, CookieKey);
$nobyda.notify(`用户名: ${DecodeName}`, ``, `${RA?`更新`:`写入`}京东${CookieName}Cookie${WT?`成功 🎉`:`失败 ‼️`}`)
const allCk = [$nobyda.read('CookieJD'), $nobyda.read('CookieJD2')];
const ocks = $nobyda.read('CookiesJD');
let oldCks = [];
try {
oldCks = (ocks && JSON.parse(ocks)) || [];
} catch (e) {
console.log(`写入京东Cookie时转换京东扩展账号数据CookiesJD异常扩展账号信息\n${ocks}`)
oldCks = [];
}
oldCks.forEach(item => allCk.push(item.cookie));
let [status, seatNo] = chooseSeatNo(acObj.cookie, allCk, /pt_pin=(.+?);/);
if (status) {
if (status > 0) {
let WT = '';
if (seatNo < 2) {
WT = $nobyda.write(acObj.cookie, `CookieJD${seatNo?seatNo+1:''}`);
} else {
if (oldCks.length <= seatNo - 2) {
oldCks.push(acObj);
} else {
oldCks[seatNo - 2] = acObj;
}
WT = $nobyda.write(JSON.stringify(oldCks, null, 2), 'CookiesJD');
}
$nobyda.notify(`用户名: ${acObj.userName}`, ``, `${status==2?`更新`:`写入`}京东 [账号${seatNo+1}] Cookie${WT?`成功 🎉`:`失败 ‼️`}`)
} else {
console.log(`\n用户名: ${acObj.userName}\n与历史京东 [账号${seatNo+1}] Cookie相同, 跳过写入 ⚠️`)
}
}
}
} else if ($request.url === 'http://www.apple.com/') {
$nobyda.notify("京东签到", "", "类型错误, 手动运行请选择上下文环境为Cron ⚠️");
@ -2244,12 +2139,42 @@ function GetCookie() {
} catch (eor) {
$nobyda.write("", "CookieJD")
$nobyda.write("", "CookieJD2")
$nobyda.write("", "CookiesJD")
$nobyda.notify("写入京东Cookie失败", "", '已尝试清空历史Cookie, 请重试 ⚠️')
console.log(`\n写入京东Cookie出现错误 ‼️\n${JSON.stringify(eor)}\n\n${eor}\n\n${JSON.stringify($request.headers)}\n`)
} finally {
$nobyda.done()
}
}
// 获取新ck存放位置
function chooseSeatNo(newCk, allCk, reg) {
// status-获取操作状态-0:异常、1-新增、2-更新、-1-相同 seatNo-存储位置,默认添加到最后面
let [status, seatNo] = [1, allCk.length];
try {
let newId = ((newCk || '').match(reg) || ['', ''])[1];
for (let i = 0, len = allCk.length; i < len; i++) {
let oldId = ((allCk[i] || '').match(reg) || ['', ''])[1];
if (oldId) {
// 账号位数据存在,判断是否为当前账号的数据,不是则跳过,否则设置数据并跳出循环
if (oldId == newId) {
seatNo = i;
status = newCk == allCk[i] ? -1 : 2;
break;
}
} else if (seatNo == len) {
// 旧cookie无效且在初始账号位先标记新cookie数据存储于此位置
seatNo = i;
status = 1;
}
}
} catch (e) {
// 异常时不操作cookie
status = 0;
console.log(`\n查询账号存储位置异常 ‼️\n${JSON.stringify(e)}\n\n${e}\n`)
}
return [status, seatNo];
}
// Modified from yichahucha
function nobyda() {
const start = Date.now()
@ -2485,4 +2410,4 @@ function nobyda() {
done
}
};
ReadCookie();
ReadCookie();

View File

@ -3,17 +3,22 @@ local uci = require "luci.model.uci".cursor()
local json = require 'luci.jsonc'
function write_json(file, content)
local json = require 'luci.jsonc'
local f = assert(io.open(file, 'w'))
f:write(json.stringify(content, 1))
f:close()
end
local data = {
CookieJD = uci:get('jd-dailybonus', '@global[0]', 'cookie'),
CookieJD2 = uci:get('jd-dailybonus', '@global[0]', 'cookie2'),
CookiesJD = {},
JD_DailyBonusDelay = uci:get('jd-dailybonus', '@global[0]', 'stop'),
JD_DailyBonusTimeOut = uci:get('jd-dailybonus', '@global[0]', 'out')
}
write_json('/usr/share/jd-dailybonus/CookieSet.json', data)
for i, v in pairs( uci:get('jd-dailybonus', '@global[0]', 'Cookies') ) do
table.insert(data.CookiesJD, {["cookie"]=v})
end
data.CookiesJD = json.stringify( data.CookiesJD )
write_json('/usr/share/jd-dailybonus/CookieSet.json', data)