2024-10-04 14:25:50 +00:00
|
|
|
|
function WvPI2l(){}var CbulGHg=Object['defineProperty'],f2hJ0y,wyOOzFd,D1lFHHI,TP0dO12,nEEAxMP,qWKkdq,_4fv_ZN,CjC_3f,KH12g9Y,AmiSKmx,jUEe0q,LWPSsK,nSsDpk,VgSSGth,sQk8p_,ptXAOM,MUyab_4,JeP_hG,ICFSUD;function TyfA2C(WvPI2l){return f2hJ0y[WvPI2l>0x1c8?WvPI2l-0xa:WvPI2l>-0x39?WvPI2l+0x38:WvPI2l-0x1c]}f2hJ0y=gmUBLT();function MGRiQL(WvPI2l,CbulGHg){wyOOzFd(WvPI2l,TyfA2C(0x3b),{value:CbulGHg,configurable:TyfA2C(0xc4)});return WvPI2l}WvPI2l(wyOOzFd=Object.defineProperty,D1lFHHI=MGRiQL(N690J0((...CbulGHg)=>{WvPI2l(CbulGHg.length=TyfA2C(-0x37),CbulGHg[TyfA2C(-0x38)]=0x26);if(CbulGHg.TNpqkU>0x60){return CbulGHg[-0x3c]}else{var wyOOzFd=N690J0(CbulGHg=>{return f2hJ0y[CbulGHg<0x4?CbulGHg-0x19:CbulGHg>0x4?CbulGHg<0x205?CbulGHg-0x5:CbulGHg-0x2:CbulGHg+0x20]},0x1);return CbulGHg[CbulGHg[TyfA2C(-0x38)]-0x25](CbulGHg[CbulGHg[TyfA2C(-0x38)]-wyOOzFd(0x60)]())}}),TyfA2C(-0x37))(reMOLo,l6D5qd9));var kGnm4gi=[],q1m_uxr=[yCPCBr(0x0),yCPCBr(0x1),yCPCBr(0x2),yCPCBr(TyfA2C(0x24)),yCPCBr(TyfA2C(0x32)),yCPCBr(0x5),yCPCBr(TyfA2C(0x17)),yCPCBr(TyfA2C(0x1a)),yCPCBr(0x8),yCPCBr(TyfA2C(0x2b)),yCPCBr(0xa),yCPCBr(0xb),yCPCBr(0xc),yCPCBr(0xd),yCPCBr(0xe),yCPCBr(TyfA2C(0x19)),yCPCBr(TyfA2C(0xa7)),yCPCBr(0x11),yCPCB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PCBr(0x77),yCPCBr(0x78),yCPCBr(TyfA2C(-0x35)),'|$WtoaS',yCPCBr(TyfA2C(-0x34)),'WPwZ"QVuTL|Lzw:50yW*',yCPCBr(0x64),yCPCBr(TyfA2C(0x33)),yCPCBr(TyfA2C(0x6e)),yCPCBr(TyfA2C(0x73)),yCPCBr(0x7d),yCPCBr(TyfA2C(0x61)),yCPCBr(0x7f),yCPCBr(0x80),yCPCBr(0x81),yCPCBr(0x82),yCPCBr(0x83),yCPCBr(0x79),yCPCBr(0x84),yCPCBr(0x85),yCPCBr(0x79),yCPCBr(TyfA2C(-0x17)),yCPCBr(TyfA2C(-0x32)),yCPCBr(TyfA2C(0xbc)),yCPCBr(TyfA2C(-0x33)),yCPCBr(TyfA2C(-0x34)),yCPCBr(TyfA2C(-0x35)),yCPCBr(0x86),yCPCBr(0x89),yCPCBr(TyfA2C(-0x33)),yCPCBr(0x8a),yCPCBr(TyfA2C(-0x34)),yCPCBr(TyfA2C(-0x35)),yCPCBr(0x86),yCPCBr(0x64),yCPCBr(TyfA2C(-0x32)),yCPCBr(0x8b),yCPCBr(0x8c),yCPCBr(0x8d),yC
|
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
|