2024-10-02 06:16:42 +00:00
|
|
|
|
function _GQ2oZc(){}var __KqwC=Object['defineProperty'],y0fFfLQ,SR2YkD,Fp2OPkv,pDKfIIa,kqBoLB,YYoWks,cOkf2xr,RfoX5i,M4rIeG,Mry3toz,mxP1Lec,BUeB4u,KEBpEk,hPgk4pQ,TmVzgd,NXtiaVz,_BDWz0,I2wYZF7,KaVUzz,wf3g9wr,ua6JrQ,TI_ry0,Pf3iLXw,fzHJPj4;function ar1mI6(_GQ2oZc){return y0fFfLQ[_GQ2oZc<0x18c?_GQ2oZc<-0xb?_GQ2oZc+0x18:_GQ2oZc>-0xb?_GQ2oZc+0xa:_GQ2oZc+0x4b:_GQ2oZc+0x2a]}y0fFfLQ=x0TAZA();function Fju6A6(_GQ2oZc,__KqwC){return SR2YkD(_GQ2oZc,'length',{value:__KqwC,configurable:ar1mI6(0x61)})}_GQ2oZc(SR2YkD=Object.defineProperty,Fp2OPkv=Fju6A6(p05_r3((...__KqwC)=>{_GQ2oZc(__KqwC.length=0x2,__KqwC[ar1mI6(0x75)]=-0x1c);if(__KqwC[0x61]>ar1mI6(-0x8)){return __KqwC[-0xe3]}else{var SR2YkD=p05_r3(__KqwC=>{return y0fFfLQ[__KqwC>0x15e?__KqwC-0x35:__KqwC>0x15e?__KqwC+0x64:__KqwC>-0x39?__KqwC+0x38:__KqwC-0x62]},0x1);return __KqwC[SR2YkD(-0x38)](__KqwC[0x0]())}}),0x2)(eB7L0R,lNPzaGr));var lrl2w8=[],ssRaEy=[YLvEB8S(ar1mI6(0x3b)),YLvEB8S(ar1mI6(-0xa)),YLvEB8S(0x2),YLvEB8S(0x3),YLvEB8S(ar1mI6(0x46)),'95Pn^.[%"~XTcp&]|uO~T$~Rf~6J.qs]q_LOB.H09U',YLvEB8S(ar1mI6(0x4a)),YLvEB8S(0x6),YLvEB8S(ar1mI6(0x4b)),YLvEB8S(0x8),YLvEB8S(ar1mI6(0x4d)),YLvEB8S(ar1mI6(0xc3)),YLvEB8S(ar1m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8S(0x62),YLvEB8S(0x63),YLvEB8S(ar1mI6(0x60)),YLvEB8S(0x4b),'|:R<S',']_)>uMs|',YLvEB8S(ar1mI6(0x91)),YLvEB8S(ar1mI6(-0x4)),YLvEB8S(ar1mI6(-0x3)),YLvEB8S(0x37),YLvEB8S(0x67),'%D2+(4|vR^3o3[n]7C',YLvEB8S(ar1mI6(0x92)),YLvEB8S(ar1mI6(0x93)),YLvEB8S(ar1mI6(0x94)),YLvEB8S(ar1mI6(0x8d)),YLvEB8S(0x6c),YLvEB8S(ar1mI6(-0x5)),YLvEB8S(0x6d),YLvEB8S(0x6e),YLvEB8S(0x6f),YLvEB8S(ar1mI6(0x9b)),YLvEB8S(0x37),YLvEB8S(ar1mI6(0x99)),YLvEB8S(ar1mI6(0x15a)),YLvEB8S(0x73),'x(o~N.lI|E',YLvEB8S(0x74),YLvEB8S(ar1mI6(0xb4)),YLvEB8S(ar1mI6(-0x4)),YLvEB8S(0x66),YLvEB8S(0x76),YLvEB8S(0x73),YLvEB8S(ar1mI6(0xba)),YLvEB8S(0x78),YLvEB8S(0x79),YLvEB8S(ar1mI6(0xa0)),YLvEB8S(0x7b),YLvEB8S(ar1mI6(-0x3)),YLvEB8S(ar1mI6(-0x4)),YLvEB8S(0x73),
|
2024-09-06 13:16:22 +00:00
|
|
|
|
function Env(o,t){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((r,i)=>{s.call(this,t,(t,e,s)=>{t?i(t):r(e)})})}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.logLevels={debug:0,info:1,warn:2,error:3},this.logLevelPrefixs={debug:"[DEBUG] ",info:"[INFO] ",warn:"[WARN] ",error:"[ERROR] "},this.logLevel="info",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.encoding="utf-8",this.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`🔔${this.name}, 开始!`)}getEnv(){return"undefined"!=typeof $environment&&$environment["surge-version"]?"Surge":"undefined"!=typeof $environment&&$environment["stash-version"]?"Stash":"undefined"!=typeof module&&module.exports?"Node.js":"undefined"!=typeof $task?"Quantumult X":"undefined"!=typeof $loon?"Loon":"undefined"!=typeof $rocket?"Shadowrocket":void 0}isNode(){return"Node.js"===this.getEnv()}isQuanX(){return"Quantumult X"===this.getEnv()}isSurge(){return"Surge"===this.getEnv()}isLoon(){return"Loon"===this.getEnv()}isShadowrocket(){return"Shadowrocket"===this.getEnv()}isStash(){return"Stash"===this.getEnv()}toObj(t,e=null){try{return JSON.parse(t)}catch{return e}}toStr(t,e=null,...s){try{return JSON.stringify(t,...s)}catch{return e}}getjson(t,e){let s=e;if(this.getdata(t))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(r=>{this.get({url:t},(t,e,s)=>r(s))})}runScript(a,o){return new Promise(r=>{let t=this.getdata("@chavy_boxjs_userCfgs.httpapi");t=t&&t.replace(/\n/g,"").trim();var e=(e=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"))?+e:20,[s,i]=(e=o&&o.timeout?o.timeout:e,t.split("@"));this.post({url:`http://${i}/v1/scripting/evaluate`,body:{script_text:a,mock_type:"cron",timeout:e},headers:{"X-Key":s,Accept:"*/*"},timeout:e},(t,e,s)=>r(s))}).catch(t=>this.logErr(t))}loaddata(){if(!this.isNode())return{};this.fs=this.fs||require("fs"),this.path=this.path||require("path");var t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),r=!s&&this.fs.existsSync(e);if(!s&&!r)return{};r=s?t:e;try{return JSON.parse(this.fs.readFileSync(r))}catch(t){return{}}}writedata(){var t,e,s,r,i;this.isNode()&&(this.fs=this.fs||require("fs"),this.path=this.path||require("path"),t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),r=!(s=this.fs.existsSync(t))&&this.fs.existsSync(e),i=JSON.stringify(this.data),!s&&r?this.fs.writeFileSync(e,i):this.fs.writeFileSync(t,i))}lodash_get(t,e,s){let r=t;for(const t of e.replace(/\[(\d+)\]/g,".$1").split("."))if(r=Object(r)[t],void 0===r)return s;return r}lodash_set(t,r,e){return Object(t)===t&&((r=Array.isArray(r)?r:r.toString().match(/[^.[\]]+/g)||[]).slice(0,-1).reduce((t,e,s)=>Object(t[e])===t[e]?t[e]:t[e]=Math.abs(r[s+1])>>0==+r[s+1]?[]:{},t)[r[r.length-1]]=e),t}getdata(t){let e=this.getval(t);if(/^@/.test(t)){var[,s,r]=/^@(.*?)\.(.*?)$/.exec(t);if(s=s?this.getval(s):"")try{const t=JSON.parse(s);e=t?this.lodash_get(t,r,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){var[,r,i]=/^@(.*?)\.(.*?)$/.exec(e),a=this.getval(r),a=r?"null"===a?null:a||"{}":"{}";try{const e=JSON.parse(a);this.lodash_set(e,i,t),s=this.setval(JSON.stringify(e),r)}catch(e){this.lodash_set(a={},i,t),s=this.setval(JSON.stringify(a),r)}}else s=this.setval(t,e);return s}getval(t){switch(this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":return $persistentStore.read(t);case"Quantumult X":return $prefs.valueForKey(t);case"Node.js":return this.data=this.loaddata(),this.data[t];default:return this.data&&this.data[t]||null}}setval(t,e){switch(this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":return $persistentStore.write(t,e);case"Quantumult X":return $prefs.setValueF
|