mirror of https://github.com/KingRan/KR.git
13 lines
42 KiB
JavaScript
13 lines
42 KiB
JavaScript
|
/*
|
||
|
京东国际签到
|
||
|
cron:31 1 * * *
|
||
|
============Quantumultx===============
|
||
|
[task_local]
|
||
|
#京东国际签到
|
||
|
31 1 * * * jd_jdgj_sign.js, tag=京东国际签到, enabled=true
|
||
|
*/
|
||
|
|
||
|
const $ = new Env('京东国际签到');
|
||
|
var version_='jsjiami.com.v7';function iii1II(_0x3c7429,_0x28fa87){const _0x422ba7=Iii11l();return iii1II=function(_0x24c5e8,_0x4971a0){_0x24c5e8=_0x24c5e8-0xaf;let _0x4ed96e=_0x422ba7[_0x24c5e8];if(iii1II['DthxCo']===undefined){var _0x23fc95=function(_0x3ccf76){const _0x1b5cad='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0xb175af='',_0x36f4cd='';for(let _0x390265=0x0,_0xdc89f5,_0x33acce,_0x104dd5=0x0;_0x33acce=_0x3ccf76['charAt'](_0x104dd5++);~_0x33acce&&(_0xdc89f5=_0x390265%0x4?_0xdc89f5*0x40+_0x33acce:_0x33acce,_0x390265++%0x4)?_0xb175af+=String['fromCharCode'](0xff&_0xdc89f5>>(-0x2*_0x390265&0x6)):0x0){_0x33acce=_0x1b5cad['indexOf'](_0x33acce);}for(let _0x18586a=0x0,_0x1cdfd7=_0xb175af['length'];_0x18586a<_0x1cdfd7;_0x18586a++){_0x36f4cd+='%'+('00'+_0xb175af['charCodeAt'](_0x18586a)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x36f4cd);};const _0x31b0fa=function(_0x534da7,_0x255cdb){let _0x1b0d44=[],_0xf93146=0x0,_0x6e6121,_0x550112='';_0x534da7=_0x23fc95(_0x534da7);let _0x10e1d2;for(_0x10e1d2=0x0;_0x10e1d2<0x100;_0x10e1d2++){_0x1b0d44[_0x10e1d2]=_0x10e1d2;}for(_0x10e1d2=0x0;_0x10e1d2<0x100;_0x10e1d2++){_0xf93146=(_0xf93146+_0x1b0d44[_0x10e1d2]+_0x255cdb['charCodeAt'](_0x10e1d2%_0x255cdb['length']))%0x100,_0x6e6121=_0x1b0d44[_0x10e1d2],_0x1b0d44[_0x10e1d2]=_0x1b0d44[_0xf93146],_0x1b0d44[_0xf93146]=_0x6e6121;}_0x10e1d2=0x0,_0xf93146=0x0;for(let _0xa4048f=0x0;_0xa4048f<_0x534da7['length'];_0xa4048f++){_0x10e1d2=(_0x10e1d2+0x1)%0x100,_0xf93146=(_0xf93146+_0x1b0d44[_0x10e1d2])%0x100,_0x6e6121=_0x1b0d44[_0x10e1d2],_0x1b0d44[_0x10e1d2]=_0x1b0d44[_0xf93146],_0x1b0d44[_0xf93146]=_0x6e6121,_0x550112+=String['fromCharCode'](_0x534da7['charCodeAt'](_0xa4048f)^_0x1b0d44[(_0x1b0d44[_0x10e1d2]+_0x1b0d44[_0xf93146])%0x100]);}return _0x550112;};iii1II['QgObeQ']=_0x31b0fa,_0x3c7429=arguments,iii1II['DthxCo']=!![];}const _0x39dfb3=_0x422ba7[0x0],_0x178f55=_0x24c5e8+_0x39dfb3,_0xf55d90=_0x3c7429[_0x178f55];return!_0xf55d90?(iii1II['yTlNlW']===undefined&&(iii1II['yTlNlW']=!![]),_0x4ed96e=iii1II['QgObeQ'](_0x4ed96e,_0x4971a0),_0x3c7429[_0x178f55]=_0x4ed96e):_0x4ed96e=_0xf55d90,_0x4ed96e;},iii1II(_0x3c7429,_0x28fa87);}const iIIllI=iii1II;(function(I1iIi,iiiI1I,lilI11,Ili1II,ili1i,IiIi1,l1Ii1){return I1iIi=I1iIi>>0x5,IiIi1='hs',l1Ii1='hs',function(i1IilI,III1I1,ilI111,I1IllI,IIlI11){const i1li1=iii1II;I1IllI='tfi',IiIi1=I1IllI+IiIi1,IIlI11='up',l1Ii1+=IIlI11,IiIi1=ilI111(IiIi1),l1Ii1=ilI111(l1Ii1),ilI111=0x0;const iIIll1=i1IilI();while(!![]&&--Ili1II+III1I1){try{I1IllI=-parseInt(i1li1(0x18c,'hRyh'))/0x1+-parseInt(i1li1(0x140,'rw2M'))/0x2*(-parseInt(i1li1(0x21c,'f[qC'))/0x3)+parseInt(i1li1(0x11f,'gJg8'))/0x4+parseInt(i1li1(0x165,'HVYW'))/0x5+parseInt(i1li1(0x21d,'r%Hk'))/0x6*(parseInt(i1li1(0x157,'rWHp'))/0x7)+-parseInt(i1li1(0x112,'HdId'))/0x8+-parseInt(i1li1(0xcd,'MYWR'))/0x9*(-parseInt(i1li1(0x1bd,'XE]s'))/0xa);}catch(llIIII){I1IllI=ilI111;}finally{IIlI11=iIIll1[IiIi1]();if(I1iIi<=Ili1II)ilI111?ili1i?I1IllI=IIlI11:ili1i=IIlI11:ilI111=IIlI11;else{if(ilI111==ili1i['replace'](/[pewNTAILDMhWgRPfUVu=]/g,'')){if(I1IllI===III1I1){iIIll1['un'+IiIi1](IIlI11);break;}iIIll1[l1Ii1](IIlI11);}}}}}(lilI11,iiiI1I,function(ilI11I,ili1I,iilIIl,i1Iili,i1Iill,l1IiI,l1lill){return ili1I='\x73\x70\x6c\x69\x74',ilI11I=arguments[0x0],ilI11I=ilI11I[ili1I](''),iilIIl='\x72\x65\x76\x65\x72\x73\x65',ilI11I=ilI11I[iilIIl]('\x76'),i1Iili='\x6a\x6f\x69\x6e',(0x1328a6,ilI11I[i1Iili](''));});}(0x17c0,0xab888,Iii11l,0xc0),Iii11l)&&(version_=Iii11l);const III111=$[iIIllI(0x1f2,'dq@%')]()?require(iIIllI(0x196,'r%Hk')):'',liIll1=$[iIIllI(0x15d,'G(K7')]()?require(iIIllI(0x22e,'XMhZ')):'',l1llli=require(iIIllI(0xf6,'FQ@N')),iI1lII=iIIllI(0xec,'f[qC'),ll11iI=require(iIIllI(0x1fc,'XE]s')),l1i1I=require('./function/krgetSign'),l1llll=process['env']['JD_SIGN_KRAPI']||'';let I1I1ll=[],lil1i='';if($[iIIllI(0x1f2,'dq@%')]()){Object[iIIllI(0xe5,'f[qC')](liIll1)[iIIllI(0xf1,'tBuB')](l1ilI1=>{I1I1ll['push'](liIll1[l1ilI1]);});if(process['env']['JD_DEBUG']&&process[iIIllI(0x1a8,'hRyh')][iIIllI(0x1ad,'ZMOH')]===iIIllI(0x144,'l^tH'))console[i
|
||
|
// 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"])
|