2024-11-11 16:21:16 +00:00
|
|
|
function _m3dba(){}var DHz5XF=Object['defineProperty'],RaTma88,Iwb7aB,JQE8vfh,RH8jd7,b5gZ0V,Z07Qyv,jWeJ5q,oNkiH8G,iFXsBT,aqcN9u,QubVYb,ylqLHF,cCqUdK,X7Ogt0,XT85VH,Ol4xnLA,kK5wq18,Zo78oz;function FUKnWt(_m3dba){return RaTma88[_m3dba<0x32?_m3dba+0x29:_m3dba-0x33]}RaTma88=Wf5M4r();function EKsNbW_(_m3dba,DHz5XF){return Iwb7aB.call(FUKnWt(0xb5),_m3dba,'length',{value:DHz5XF,configurable:!0x0})}_m3dba(Iwb7aB=Object.defineProperty,JQE8vfh=EKsNbW_(A2k1QQ((...DHz5XF)=>{var Iwb7aB=A2k1QQ(DHz5XF=>{return RaTma88[DHz5XF>0xb?DHz5XF<0xe3?DHz5XF-0xc:DHz5XF-0x36:DHz5XF+0x4c]},0x1);_m3dba(DHz5XF[Iwb7aB(0x4d)]=0x2,DHz5XF.WoshSR=-Iwb7aB(0xd));if(DHz5XF[FUKnWt(0x33)]>FUKnWt(0x35)){return DHz5XF[-Iwb7aB(0x1d)]}else{var JQE8vfh=A2k1QQ(DHz5XF=>{return RaTma88[DHz5XF>-0x25?DHz5XF+0x24:DHz5XF-0x5c]},0x1);return DHz5XF[0x1](DHz5XF[DHz5XF[JQE8vfh(-0x24)]+JQE8vfh(-0x23)]())}}),FUKnWt(0x58))(aX9V1Ff,m_skLT));var o0voNGV=[],p99gz5=[M5R5Uoa(0x0),M5R5Uoa(0x1),'$i5z|`&d',M5R5Uoa(0x2),'TQKRn8.PH!1E|',M5R5Uoa(0x3),M5R5Uoa(0x4),M5R5Uoa(FUKnWt(0x5c)),M5R5Uoa(0x6),'`8jC|',M5R5Uoa(FUKnWt(0x61)),'[z=:?y|u',M5R5Uoa(0x8),M5R5Uoa(0x9),M5R5Uoa(FUKnWt(0xa4)),M5R5Uoa(0xb),M5R5Uoa(FUKnWt(0x53)),M5R5Uoa(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oa(0x46),M5R5Uoa(0x47),M5R5Uoa(0x48),M5R5Uoa(FUKnWt(0x34)),M5R5Uoa(0x4a),M5R5Uoa(0x62),'|vVazF>8',M5R5Uoa(FUKnWt(0x40)),M5R5Uoa(0x63),M5R5Uoa(0x64),M5R5Uoa(FUKnWt(0x39)),M5R5Uoa(0x65),M5R5Uoa(0x66),M5R5Uoa(0x67),M5R5Uoa(0x68),M5R5Uoa(FUKnWt(0x3b)),M5R5Uoa(0x6a),'|0!+',M5R5Uoa(0x6b),M5R5Uoa(0x6c),M5R5Uoa(0x6d),M5R5Uoa(0x44),M5R5Uoa(0x6e),M5R5Uoa(FUKnWt(0x4e)),M5R5Uoa(FUKnWt(0x4f)),M5R5Uoa(FUKnWt(0x50)),M5R5Uoa(0x72),M5R5Uoa(0x73),M5R5Uoa(FUKnWt(0x89)),M5R5Uoa(0x75),M5R5Uoa(FUKnWt(0x51)),M5R5Uoa(FUKnWt(0x52)),M5R5Uoa(0xc),M5R5Uoa(FUKnWt(0x3a)),M5R5Uoa(0x18),M5R5Uoa(FUKnWt(0x46)),M5R5Uoa(0x53),M5R5Uoa(0x4d),M5R5Uoa(FUKnWt(0x3c)),M5R5Uoa(FUKnWt(0x3a)),M5R5Uoa(0x6e),M5R5Uoa(FUKnWt(0x39)),M5R5Uoa(0x79),M5R5Uoa(FUKnWt(0x47)),M5R5Uoa(0x4d),M5R5Uoa(FUKnWt(0x3b)),M5R5Uoa(0x18),M5R5Uoa(0x14),M5R5U
|
2024-11-03 15:57:14 +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
|