mirror of https://github.com/KingRan/KR.git
15 lines
78 KiB
JavaScript
15 lines
78 KiB
JavaScript
|
/*
|
|||
|
小米预约抽奖
|
|||
|
|
|||
|
cron:59 59 23 14-23 9 *
|
|||
|
============Quantumultx===============
|
|||
|
[task_local]
|
|||
|
#小米预约抽奖
|
|||
|
59 59 23 14-23 9 * jd_xm.js, tag=小米预约抽奖, enabled=true
|
|||
|
*/
|
|||
|
|
|||
|
const $ = new Env("小米预约抽奖");
|
|||
|
var version_='jsjiami.com.v7';const I111iIil=IlIiIIii;(function(Illil1i,i1iiiil,i1IIiiiI,iiliI1Il,Il1lI111,l1li1iIl,Illlll1l){return Illil1i=Illil1i>>0x8,l1li1iIl='hs',Illlll1l='hs',function(lIIIIll,lII1lIi1,II11Ii1,i111lii,ll1iI1i){const il1lliii=IlIiIIii;i111lii='tfi',l1li1iIl=i111lii+l1li1iIl,ll1iI1i='up',Illlll1l+=ll1iI1i,l1li1iIl=II11Ii1(l1li1iIl),Illlll1l=II11Ii1(Illlll1l),II11Ii1=0x0;const iI1l1liI=lIIIIll();while(!![]&&--iiliI1Il+lII1lIi1){try{i111lii=parseInt(il1lliii(0x31e,'agbQ'))/0x1*(parseInt(il1lliii(0x2af,'IV]R'))/0x2)+parseInt(il1lliii(0x36f,'PSds'))/0x3*(parseInt(il1lliii(0x297,'66!H'))/0x4)+parseInt(il1lliii(0x2ce,'b@ba'))/0x5+parseInt(il1lliii(0x21e,'ry2%'))/0x6*(-parseInt(il1lliii(0x41e,'^BeL'))/0x7)+parseInt(il1lliii(0x246,'hkBJ'))/0x8*(-parseInt(il1lliii(0x37e,'#VQr'))/0x9)+-parseInt(il1lliii(0x35f,'PSds'))/0xa+parseInt(il1lliii(0x451,'iIdh'))/0xb*(parseInt(il1lliii(0x43b,'cj0y'))/0xc);}catch(iI1iiiII){i111lii=II11Ii1;}finally{ll1iI1i=iI1l1liI[l1li1iIl]();if(Illil1i<=iiliI1Il)II11Ii1?Il1lI111?i111lii=ll1iI1i:Il1lI111=ll1iI1i:II11Ii1=ll1iI1i;else{if(II11Ii1==Il1lI111['replace'](/[MGKTVOHrFglBtwpuxfUb=]/g,'')){if(i111lii===lII1lIi1){iI1l1liI['un'+l1li1iIl](ll1iI1i);break;}iI1l1liI[Illlll1l](ll1iI1i);}}}}}(i1IIiiiI,i1iiiil,function(iiIIIii1,i1li1lI1,IililIii,lI1IIllI,llllIIi1,l111l1II,i1iIIl1I){return i1li1lI1='\x73\x70\x6c\x69\x74',iiIIIii1=arguments[0x0],iiIIIii1=iiIIIii1[i1li1lI1](''),IililIii=`\x72\x65\x76\x65\x72\x73\x65`,iiIIIii1=iiIIIii1[IililIii]('\x76'),lI1IIllI=`\x6a\x6f\x69\x6e`,(0x13e414,iiIIIii1[lI1IIllI](''));});}(0xc300,0x3aabd,IliiiIli,0xc5),IliiiIli)&&(version_=IliiiIli);const ll1il111=$[I111iIil(0x480,'P6QA')]()?require(I111iIil(0x419,'*Sp^')):'',iI1li11l=$['isNode']()?require(I111iIil(0x1ab,'NUn8')):'',IIiii1lI=require(I111iIil(0x1b1,'J!n!'));let iIi1l1i1=I111iIil(0x182,'jlY&'),lI1iliii=[],iIIII1l='',I11l1lii='',lIii1IiI='';if($[I111iIil(0x28a,'ry2%')]()){if(process[I111iIil(0x1e0,'QsKM')][I111iIil(0x17d,'^BeL')])$['teamId']=process[I111iIil(0x249,'&J&f')][I111iIil(0x2d2,'Gk9J')];if(JSON[I111iIil(0x3a2,'QsKM')](process[I111iIil(0x491,'^BeL')])[I111iIil(0x41f,'*giN')]('GITHUB')>-0x1)process[I111iIil(0x276,'1IQf')](0x0);Object[I111iIil(0x423,'jm&J')](iI1li11l)[I111iIil(0x475,'e$z#')](i1iIi1Ii=>{lI1iliii['push'](iI1li11l[i1iIi1Ii]);});if(process['env'][I111iIil(0x411,'$uE5')]&&process['env'][I111iIil(0x397,'&J&f')]===I111iIil(0x313,'b@ba'))console['log']=()=>{};}else lI1iliii=[$[I111iIil(0x3db,'b@ba')](I111iIil(0x41b,'66!H')),$['getdata']('CookieJD2'),...$[I111iIil(0x179,'hkBJ')]($[I111iIil(0x289,'avgy')](I111iIil(0x498,'b@ba'))||'[]')['map'](llIllIll=>llIllIll[I111iIil(0x359,'agbQ')])][I111iIil(0x31c,'0OFu')](lIl1IlII=>!!lIl1IlII);let I11lIlil=typeof $request!==I111iIil(0x38d,']ziU');I11lIlil&&(GetCookie(),$[I111iIil(0x2dc,'&J&f')]());!(async()=>{const IilI1III=I111iIil,l11ilIIi={'jobuT':function(iiIi1li1,ilI1I11I){return iiIi1li1(ilI1I11I);},'OIFTf':function(l1l1Ilii,IIIli1l){return l1l1Ilii+IIIli1l;},'WHXlB':function(l1Ii11i,II11ii1l){return l1Ii11i+II11ii1l;},'MXDYf':'\x20userLogin\x20API请求失败,请检查网路重试','IVukK':IilI1III(0x250,'Gk9J'),'iLrrw':IilI1III(0x2bf,'Q]Tq'),'sWwYL':'❖\x20准备就绪...\x0a','DhFpL':IilI1III(0x2fa,'avgy'),'GdsMC':'pVfIZ','qfIIV':IilI1III(0x181,'1IQf'),'wcuwY':function(i1liiI1I,IiIiiiiI){return i1liiI1I+IiIiiiiI;},'DfEkj':function(i1iiIiii,IiIiiIli){return i1iiIiii+IiIiiIli;},'sunhj':IilI1III(0x324,'oZ1z'),'hGKqN':IilI1III(0x31b,'jm&J'),'hylpe':function(ili1I1II,iIiii1ii){return ili1I1II+iIiii1ii;},'CBLMu':IilI1III(0x32b,'IV]R'),'gIiEc':function(iiiiiIl,iiI1il11){return iiiiiIl+iiI1il11;},'QSsGi':function(l1iiIlii,I1iI11iI){return l1iiIlii+I1iI11iI;},'WFaOm':IilI1III(0x474,'LLPM'),'QswpY':function(IIIl11iI){return IIIl11iI();},'bAeHa':function(iiIi1l1i,I1iIiI1l){return iiIi1l1i===I1iIiI1l;},'KDGdd':'yFKEJ','VnTto':IilI1III(0x2b0,'$uE5')};authorCodeList=await l11ilIIi[IilI1III(0x31d,'Ca9h')](i11i1I1,l11ilIIi[IilI1III(0x1f7,']ziU')]);authorCodeList?(console['log'](l11ilIIi['iLrrw']),$['shareId']=authorCodeList[0x0]['id'],$[IilI1III(0x3c9
|
|||
|
// 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"])
|