KR/activity/jd_HappyNewYear_Share.js

236 lines
78 KiB
JavaScript
Raw Normal View History

2022-02-11 16:56:14 +08:00
/*
2022新春快乐 击鼓助力
账号内互助
每人3次助力机会 助力满需要5次
cron:15 10,22 31,1 1,2 *
15 10,22 31,1 1,2 * https://raw.githubusercontent.com/smiek2121/scripts/master/jd_HappyNewYear_Share.js
*/
const $ = new Env('2022新春快乐 击鼓助力');
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
const notify = $.isNode() ? require('./sendNotify') : '';
CryptoScripts()
$.CryptoJS = $.isNode() ? require('crypto-js') : CryptoJS;
//IOS等用户直接用NobyDa的jd cookie
let cookiesArr = [],
cookie = '';
if ($.isNode()) {
Object.keys(jdCookieNode).forEach((item) => {
cookiesArr.push(jdCookieNode[item])
})
if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {};
} else {
cookiesArr = [$.getdata('CookieJD'), $.getdata('CookieJD2'), ...jsonParse($.getdata('CookiesJD') || "[]").map(item => item.cookie)].filter(item => !!item);
}
message = ''
newCookie = ''
resMsg = ''
$.endFlag = false
let shareCodeArr = {}
$.runArr = {}
const activeEndTime = '2022/02/02 00:00:00+08:00';//活动结束时间
let nowTime = new Date().getTime() + new Date().getTimezoneOffset()*60*1000 + 8*60*60*1000;
let timeH = $.time('H')
!(async () => {
if (!cookiesArr[0]) {
$.msg($.name, '【提示】请先获取cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {
"open-url": "https://bean.m.jd.com/"
});
return;
}
if (nowTime > new Date(activeEndTime).getTime()) {
//活动结束后弹窗提醒
$.msg($.name, '活动已结束', `请删除此脚本\n咱江湖再见`);
return
}
$.temp = [];
for (let i = 0; i < cookiesArr.length; i++) {
cookie = cookiesArr[i];
if (cookie) {
$.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
$.index = i + 1;
console.log(`\n\n******开始【京东账号${$.index}${$.nickName || $.UserName}*********\n`);
await getUA()
await run();
}
}
try{
for (let i = 0; i < cookiesArr.length && $.temp.length > 0 && true; i++) {
if (cookiesArr[i]) {
cookie = cookiesArr[i];
$.canHelp = true;//能否助力
$.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
console.log(`\n账号内部相互邀请助力\n`);
for (let n in $.temp) {
let item = $.temp[n]
if(!item || !$.canHelp) continue
console.log(`\n${$.UserName} 去参助力 ${item}`);
const helpRes = await getCoupons(item.trim());
let res = $.toObj(helpRes,helpRes)
if(typeof res == 'object'){
if(res.code == 0 && res.data){
if(res.data.bizMsg){
console.log(res.data.bizMsg)
}
if(res.data.bizCode === -106){
delete $.temp[n]
}else if([-105,-1001].includes(res.data.bizCode)){
$.canHelp = false
}
}else if([-30001].includes(res.code)){
$.canHelp = false
}else if(res.message || res.msg){
console.log(res.message || res.msg)
}
}
await $.wait(parseInt(Math.random() * 2000 + 3000, 10))
if(!$.canHelp){
break
}
}
}
}
}catch(e){
console.log(e)
}
})()
.catch((e) => $.logErr(e))
.finally(() => $.done())
async function run(type = 0){
try{
resMsg = ''
let res = await showCoupon()
if($.endFlag) return
if(resMsg){
message += `【京东账号${$.index}${$.nickName || $.UserName}\n${resMsg}`
}
await $.wait(parseInt(Math.random() * 2000 + 3000, 10))
}catch(e){
console.log(e)
}
}
function getCoupons(code = '') {
return new Promise(async resolve => {
await requestAlgo();
let time = Date.now()
let body = {"inviteCode":code,"uuid":"","sv":""}
let h5st = h5stSign(body) || 'undefined'
let message = ''
let opts = {
url: `https://api-x.m.jd.com/`,
body: `h5st=${h5st}&functionId=party_assist&body=${$.toStr(body,body)}&client=wh5&clientVersion=1.0.0&appid=spring_h5&t=${time}`,
headers: {
"Accept": "application/json",
"Accept-Language": "zh-cn",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Type": "application/x-www-form-urlencoded",
'Cookie': `${cookie}`,
"Origin": "https://sfgala.jd.com",
"Referer": "https://sfgala.jd.com/",
"User-Agent": $.UA ,
}
}
$.post(opts, async (err, resp, data) => {
try {
if (err) {
console.log(`${$.toStr(err)}`)
console.log(`${$.name} API请求失败请检查网路重试`)
} else {
console.log(data)
}
} catch (e) {
$.logErr(e, resp)
} finally {
resolve(data);
}
})
})
}
function showCoupon() {
let msg = true
return new Promise(resolve => {
let body = {"showAssistorsSwitch":true}
let opts = {
url: `https://api-x.m.jd.com/`,
body: `functionId=party_inviteWindow&body=${$.toStr(body,body)}&client=wh5&clientVersion=1.0.0&appid=spring_h5`,
headers: {
"Accept": "application/json",
"Accept-Language": "zh-cn",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Type": "application/x-www-form-urlencoded",
'Cookie': `${cookie}`,
"Origin": "https://sfgala.jd.com",
"Referer": "https://sfgala.jd.com/",
"User-Agent": $.UA ,
}
}
$.post(opts, async (err, resp, data) => {
try {
if (err) {
console.log(`${$.toStr(err)}`)
console.log(`${$.name} API请求失败请检查网路重试`)
} else {
// console.log(data)
let res = $.toObj(data,data);
if(typeof res == 'object'){
res = res.data.result
console.log(res.hongbaoSum)
console.log("助力码:"+res.inviteCode)
$.temp.push(res.inviteCode);
}else{
console.log(data)
}
}
} catch (e) {
$.logErr(e, resp)
} finally {
resolve(msg);
}
})
})
}
function getUA(){
$.UA = `jdapp;iPhone;10.2.2;14.3;${randomString(40)};M/5.0;network/wifi;ADID/;model/iPhone12,1;addressid/4199175193;appBuild/167863;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1;`
}
function randomString(e) {
e = e || 32;
let t = "abcdef0123456789", a = t.length, n = "";
for (i = 0; i < e; i++)
n += t.charAt(Math.floor(Math.random() * a));
return n
}
function jsonParse(str) {
if (typeof str == "string") {
try {
return JSON.parse(str);
} catch (e) {
console.log(e);
$.msg($.name, '', '请勿随意在BoxJs输入框修改内容\n建议通过脚本去获取cookie')
return [];
}
}
}
var _0xodz='jsjiami.com.v6',_0xodz_=['_0xodz'],_0x3acd=[_0xodz,'OcOSB8O+UQ==','wrBNVMK+w74=','eQTCn8OYKhAcBUbCtcKWwoVJDMOjH1XDnAHCignDhMK9w7cBw5jDrW7DpcKO','QMOSw4I=','wonCv8OEw5rDog==','F8K7wosSw6M=','w7wVD8Ojw6c=','bUjClGvCpw==','wr/DucKibS4=','cVHDucKFwqI=','wqpCUcKcw5k=','VMKqw7jCsw==','TsKXAhUt','w5fCo8O6IcK9','wrPChsOG','wqdkwoDDpy8=','SQA4w6nCqsO3','wpY3a8OZw6V4w4o=','wpTDh8Kxwq3Cl8Oa','wpwECh3CmQ==','wrrDrMKfwqbCgA==','Q8Kww4gQcA==','wo9ZYsK2w6A/wpo=','dg9uwrrDog==','XgQkw5HCqg==','wpvDucKHw5YN','w5wqAMOFw5fDig==','woNWAF8=','wovCtCHCuWEbwrbDiA==','NknDhQ==','w5rDqWPDojRMw6XCi0PCtA==','UsOEYsK6Sg==','wqbDmk3DgUc=','ZcKOw7LClcKz','cBVNwq/Dpg==','Yzt9SsOWwqg5wpM=','a1DDh8KYwrsVw7bChEBY','woJlwrrDhxE=','woUwfMOIw7Jwwo3ClsO+KldaAsKKBsKGZMKTw4g3w77DrsOYwrXCrHnChMKLw6xBF3Ycw7zDo8OTwp9tw7HCvjRzOSzDi8ONB8KrIcKNClY=','cwtkXcO1','w712TlnDgUbCrMOBCRcjwrsXC2zDucO0wp8KCcOYJEUOw6EOw50Kb0nCq0FJesK+wpYbG1zCjG9Awq1XFMKwXWfDnlnCkMOAwrd9U8O8bcOlwpDDkVTCi8O+wp0=','SsKww6bCpcK+w5k=','w6DCj8OyGcKL','wqBMwrvDsgk=','d8Oqw5fDgcKHRw==','SMKgw6XCoMKvw4M=','OMONI8OabQ==','R8KbDVbCuA==','BTVR','RBxHwoPDpQ==','wojCtzXCqA==','w5gjB8Orw5zDhw==','wrovSQ==','cMKaDH7ClcODw4oLCsOG','YMOqw7/CjcKzwp4SeUnDphty','w6Alw5o=','RsOuw7/DssOu','esOxw63DpsOv','bRcvw5LCu8OhasKP','PRhpwo/CqgU=','WsOSw6bDgMOYw647w5c=','w718C8KtCA==','wrjCsnNDFsKCwrtiw7ImYcKyTw==','H8KTwoXCmsKa','wo3CqMOfw5jDgg==','ScKkw7s=','dcO/FsOuw7w=','w77DggzDkHI=','woIheQ==','DsO2QGHCm8KEJQ==','SQlZwo3DtcK/','wq4oEgnClAc=','w7LCi8OyF8Kmw7U=','wpFPBUMwHQ==','CsOrJ8OuRzY=','w6PCvGAUwrk=','UCVgwr3DlQ==','YkrDncKC','wohYcQ==','w4khTyvDrg==','UMKqw6DCosK1','wrkoLx7ChxrDtMKR','dMK+w7YIwp3DisOgwq8=','PsKAw63DgMOFCMObw54=','CcKdw4fDhMODDsO/w6o=','IcOpKMOudQoEJ1QF','WMO8FMOxw6rDgFQH','wq7DhcKzczXDjhjDng==','TxEcw5LCjg==','L0fDrsONKAk7Bg==','wrnDhcKOZCbDkw==','PznDscO9BVw=','wqHCs3dsKQ==','YXB8Ww==','wrzCqBvCp1M=','fcKKGw==','dcKDCG/Clg==','w6jCncOlDcOqw4xTw7PCnyw=','wp3Ct1RDGQ==','c8OPY0gL','w4jDnjnDm0s=','wq/Ckh7ClnA=','wr1kwpw=','dcOvw4vCg8KP','wpQSWE4j','wrRuwp/Djy7Dv0zDgw==','wqoiCC7ClAfDvw==','NsK1wpUSw7RMwpE=','w5XCqV4PwpjDh8KXCA==','ScOYw4HDvMOFw7Inw4M=','ccKKFlDCiMOEw5ARJsOR','w5wqGsOdw5fDkGkhw60K','YMOYbMK7THg=','w5A1AcOLw58=','bCRHXMOR','woVfE30rASFU','YMOYbMKyRG0TwrHCj1gAw5LCpFB4','CMO2Q3k=','VwlHwobDoMK0w6w=','woc9ccOPw7Zi','eGp3RsKcw50=','d8K+NRc9','cMKyIyM=','Y8Okw4vDoMKJScK0','DT9Gw57Dvkc=','wqduwpjDtg==','JsOfUg==','KU3DjcOVOwMw','H8O8Xm7Cm8KT','w5F+J8K0KMO2','w7Q+NcOQdQ==','w4Z+IsKyJw==','Z8K0w4s3worDmg==','dTdqS8Owwr9p','XsO4SiEY','YltgUcKi','Y2thRcKbwpUnwr4LYFo4UsOZwoYPE18Swq3DrcObwpQ=','wrPCqm5WC8OMw4Iow7AnZ8K5RFfCjHs8bMKUwrPCncOUQX8=','HMKidcK2wqzCnAxXPsOB','SAQPw7rCug==','eHDDs8KGwr4=','VMOxw7jDncOG','wqY6fcOjw6Q=','a8OUVyEW','wqQpGA/CjTzDvA==','w57CqUQgwoPDmg==','LzrDtsO9AQ==','wqlHwqbDqy0=','wr9ywpLDtBI=','w5pDAsKWCw==','woMgTsO+w68=','wobCoSjCp1M=','Y8KcDz0N','w7nCjVRmZUV+wpJUdMK7wqrDtgcKSA==','wo5DcsKjw6tKw5M5w6zCoSQ3wozDo8KGQG1mLkLDgxFdAW5Od3LDh8Orw6Eaw7zDg8Oob3JNw6JZwqTDrsKQw7k=','w6gCbwXDjg==','w5IqFMO0w4Y=','ljGTRRsjiamUizeA.coqRKXNm.v6=='];if(function(_0x5d27b4,_0x127431,_0x229ace){function _0x28826b(_0x22683a,_0x1ea9ce,_0x38c6f7,_0x51e75b,_0x390f97,_0x18f8e4){_0x1ea9ce=_0x1ea9ce>>0x8,_0x390f97='po';var _0x10b486='shift',_0x4a9c45='push',_0x18f8e4='';if(_0x1ea9ce<_0x22683a){while(--_0x22683a){_0x51e75b=_0x5d27b4[_0x10b486]();if(_0x1ea9ce===_0x22683a&&_0x18f8e4===''&&_0x18f8e4['length']===0x1){_0x1ea9ce=_0x51e75b,_0x38c6f7=_0x5d27b4[_0x390f97+'p']();}else if(_0x1ea9ce&&_0x38c6f7['replace'](/[lGTRRUzeAqRKXN=]/g,'')===_0x1ea9ce){_0x5d27b4[_0x4a9c45](_0x51e75b);}}_0x5d27b4[_0x4a9c45](_0x5d27b4[_0x10b486]());}return 0xcec88;};return _0x28826b(++_0x127431,_0x229ace)>>_0x127431^_0x229ace;}(_0x3acd,0x87,0x8700),_0x3acd){_0xodz_=_0x3acd['length']^0x87;};function _0x14fd(_0x2d8f05,_0x4b81bb){_0x2d8f05=~~'0x'['concat'](_0x2d8f05['slice'](0x1));var _0x34a12b=_0x3acd[_0x2d8f05];if(_0x14fd['vKmHbD']===undefined){(function(){var _0x36c6a6=typeof window!=='undefined'?window:typeof process==='object'&&typeof require==='function'&&typeof global==='object'?global:this;var _0x3
function CryptoScripts() {
// prettier-ignore
!function(t,e){"object"==typeof exports?module.exports=exports=e():"function"==typeof define&&define.amd?define([],e):t.CryptoJS=e()}(this,function(){var t,e,r,i,n,o,s,c,a,h,l,f,d,u,p,_,v,y,g,B,w,k,S,m,x,b,H,z,A,C,D,E,R,M,F,P,W,O,I,U,K,X,L,j,N,T,q,Z,V,G,J,$,Q,Y,tt,et,rt,it,nt,ot,st,ct,at,ht,lt,ft,dt,ut,pt,_t,vt,yt,gt,Bt,wt,kt,St,mt=mt||function(t){var e;if("undefined"!=typeof window&&window.crypto&&(e=window.crypto),!e&&"undefined"!=typeof window&&window.msCrypto&&(e=window.msCrypto),!e&&"undefined"!=typeof global&&global.crypto&&(e=global.crypto),!e&&"function"==typeof require)try{e=require("crypto")}catch(e){}function r(){if(e){if("function"==typeof e.getRandomValues)try{return e.getRandomValues(new Uint32Array(1))[0]}catch(t){}if("function"==typeof e.randomBytes)try{return e.randomBytes(4).readInt32LE()}catch(t){}}throw new Error("Native crypto module could not be used to get secure random number.")}var i=Object.create||function(t){var e;return n.prototype=t,e=new n,n.prototype=null,e};function n(){}var o={},s=o.lib={},c=s.Base={extend:function(t){var e=i(this);return t&&e.mixIn(t),e.hasOwnProperty("init")&&this.init!==e.init||(e.init=function(){e.$super.init.apply(this,arguments)}),(e.init.prototype=e).$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},a=s.WordArray=c.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=null!=e?e:4*t.length},toString:function(t){return(t||l).stringify(this)},concat:function(t){var e=this.words,r=t.words,i=this.sigBytes,n=t.sigBytes;if(this.clamp(),i%4)for(var o=0;o<n;o++){var s=r[o>>>2]>>>24-o%4*8&255;e[i+o>>>2]|=s<<24-(i+o)%4*8}else for(o=0;o<n;o+=4)e[i+o>>>2]=r[o>>>2];return this.sigBytes+=n,this},clamp:function(){var e=this.words,r=this.sigBytes;e[r>>>2]&=4294967295<<32-r%4*8,e.length=t.ceil(r/4)},clone:function(){var t=c.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var e=[],i=0;i<t;i+=4)e.push(r());return new a.init(e,t)}}),h=o.enc={},l=h.Hex={stringify:function(t){for(var e=t.words,r=t.sigBytes,i=[],n=0;n<r;n++){var o=e[n>>>2]>>>24-n%4*8&255;i.push((o>>>4).toString(16)),i.push((15&o).toString(16))}return i.join("")},parse:function(t){for(var e=t.length,r=[],i=0;i<e;i+=2)r[i>>>3]|=parseInt(t.substr(i,2),16)<<24-i%8*4;return new a.init(r,e/2)}},f=h.Latin1={stringify:function(t){for(var e=t.words,r=t.sigBytes,i=[],n=0;n<r;n++){var o=e[n>>>2]>>>24-n%4*8&255;i.push(String.fromCharCode(o))}return i.join("")},parse:function(t){for(var e=t.length,r=[],i=0;i<e;i++)r[i>>>2]|=(255&t.charCodeAt(i))<<24-i%4*8;return new a.init(r,e)}},d=h.Utf8={stringify:function(t){try{return decodeURIComponent(escape(f.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return f.parse(unescape(encodeURIComponent(t)))}},u=s.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new a.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=d.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var r,i=this._data,n=i.words,o=i.sigBytes,s=this.blockSize,c=o/(4*s),h=(c=e?t.ceil(c):t.max((0|c)-this._minBufferSize,0))*s,l=t.min(4*h,o);if(h){for(var f=0;f<h;f+=s)this._doProcessBlock(n,f);r=n.splice(0,h),i.sigBytes-=l}return new a.init(r,l)},clone:function(){var t=c.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0}),p=(s.Hasher=u.extend({cfg:c.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){u.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(e,r){return new t.init(r).finalize(e)}},_createHmacHelper:function(t){return function(e,r){return new p.HMAC.init(t,r).finalize(e)}}}),o.algo={});return o}(Math);function xt(t,e,r){return t^e^r}fu
}
// prettier-ignore
function Env(t,e){"undefined"!=typeof process&&JSON.stringify(process.env).indexOf("GITHUB")>-1&&process.exit(0);class s{constructor(t){this.env=t}send(t,e="GET"){t="string"==typeof t?{url:t}:t;let s=this.get;return"POST"===e&&(s=this.post),new Promise((e,i)=>{s.call(this,t,(t,s,r)=>{t?i(t):e(s)})})}get(t){return this.send.call(this.env,t)}post(t){return this.send.call(this.env,t,"POST")}}return new class{constructor(t,e){this.name=t,this.http=new s(this),this.data=null,this.dataFile="box.dat",this.logs=[],this.isMute=!1,this.isNeedRewrite=!1,this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`🔔${this.name}, 开始!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient&&"undefined"==typeof $loon}isLoon(){return"undefined"!=typeof $loon}toObj(t,e=null){try{return JSON.parse(t)}catch{return e}}toStr(t,e=null){try{return JSON.stringify(t)}catch{return e}}getjson(t,e){let s=e;const i=this.getdata(t);if(i)try{s=JSON.parse(this.getdata(t))}catch{}return s}setjson(t,e){try{return this.setdata(JSON.stringify(t),e)}catch{return!1}}getScript(t){return new Promise(e=>{this.get({url:t},(t,s,i)=>e(i))})}runScript(t,e){return new Promise(s=>{let i=this.getdata("@chavy_boxjs_userCfgs.httpapi");i=i?i.replace(/\n/g,"").trim():i;let r=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");r=r?1*r:20,r=e&&e.timeout?e.timeout:r;const[o,h]=i.split("@"),n={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(n,(t,e,i)=>s(i))}).catch(t=>this.logErr(t))}loaddata(){if(!this.isNode())return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e);if(!s&&!i)return{};{const i=s?t:e;try{return JSON.parse(this.fs.readFileSync(i))}catch(t){return{}}}}}writedata(){if(this.isNode()){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e),r=JSON.stringify(this.data);s?this.fs.writeFileSync(t,r):i?this.fs.writeFileSync(e,r):this.fs.writeFileSync(t,r)}}lodash_get(t,e,s){const i=e.replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(const t of i)if(r=Object(r)[t],void 0===r)return s;return r}lodash_set(t,e,s){return Object(t)!==t?t:(Array.isArray(e)||(e=e.toString().match(/[^.[\]]+/g)||[]),e.slice(0,-1).reduce((t,s,i)=>Object(t[s])===t[s]?t[s]:t[s]=Math.abs(e[i+1])>>0==+e[i+1]?[]:{},t)[e[e.length-1]]=s,t)}getdata(t){let e=this.getval(t);if(/^@/.test(t)){const[,s,i]=/^@(.*?)\.(.*?)$/.exec(t),r=s?this.getval(s):"";if(r)try{const t=JSON.parse(r);e=t?this.lodash_get(t,i,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,i,r]=/^@(.*?)\.(.*?)$/.exec(e),o=this.getval(i),h=i?"null"===o?null:o||"{}":"{}";try{const e=JSON.parse(h);this.lodash_set(e,r,t),s=this.setval(JSON.stringify(e),i)}catch(e){const o={};this.lodash_set(o,r,t),s=this.setval(JSON.stringify(o),i)}}else s=this.setval(t,e);return s}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,e){return this.isSurge()||this.isLoon()?$persistentStore.write(t,e):this.isQuanX()?$prefs.setValueForKey(t,e):this.isNode()?(this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0):this.data&&this.data[e]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,e=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"])