2024-11-21 05:00:08 +00:00
|
|
|
function ott2VHg(){}var gZgoUsT=Object['defineProperty'],KwpTKw,lmaElB_,Dna63hP,HU00wFh,vTFd_L,hPSs5DX,QXhKWpZ,GA4f4QD,m8jKOe,idYHpch,Mbz5Dj,tZpnt9t,ULNMy9,tKzHMR,cJK5_u,D08NjoP,QlI5bU,RZMONK,n2ZNhU4;function LIU32c(ott2VHg){return KwpTKw[ott2VHg<0x1f9?ott2VHg<-0x53?ott2VHg+0x4b:ott2VHg+0x52:ott2VHg-0x5b]}KwpTKw=sGdG9l();function eTr6vMy(ott2VHg,gZgoUsT){return lmaElB_(ott2VHg,LIU32c(-0x11),{value:gZgoUsT,configurable:LIU32c(0x2d)})}ott2VHg(lmaElB_=Object.defineProperty,Dna63hP=NCFJ_sl((ott2VHg,gZgoUsT)=>{return gZgoUsT(ott2VHg())},0x2)(SgJgrw,tOYvaew));var jOoTlz=[],sPJcuUb=[DHXs2xF(LIU32c(-0x21)),DHXs2xF(LIU32c(-0x12)),DHXs2xF(LIU32c(-0x6)),'601|z*P}',DHXs2xF(LIU32c(-0x14)),DHXs2xF(LIU32c(0x11)),DHXs2xF(LIU32c(0x10)),DHXs2xF(LIU32c(-0x1b)),DHXs2xF(LIU32c(-0x15)),DHXs2xF(LIU32c(-0x4d)),DHXs2xF(LIU32c(0x6)),DHXs2xF(LIU32c(0x2b)),DHXs2xF(LIU32c(0x2a)),DHXs2xF(LIU32c(-0x17)),DHXs2xF(LIU32c(0xb)),DHXs2xF(LIU32c(-0xe)),DHXs2xF(LIU32c(-0x18)),DHXs2xF(LIU32c(0x30)),DHXs2xF(LIU32c(-0xd)),DHXs2xF(LIU32c(-0x52)),DHXs2xF(LIU32c(0x33)),DHXs2xF(LIU32c(0x3b)),DHXs2xF(LIU32c(-0x51)),DHXs2xF(LIU32c(0x3e)),DHXs2xF(LIU32c(0x4d)),DHXs2xF(LIU32c(0x43)),DHXs2xF(LIU32c(-0x50)),DHXs2xF(LIU32c(-0x4f)),'|l3^yS~peV7X|4#frA',DHXs2xF(LIU32c(0x42)),DHXs2xF(LIU32c(-0x4e)),DHXs2xF(LIU32c(0x13)),DHXs2xF(LIU32c(0x60)),DHXs2xF(LIU32c(-0x1c)),DHXs2xF(LIU32c(0xf)),DHXs2xF(LIU32c(-0x52)),DHXs2xF(LIU32c(-0x51)),DHXs2xF(LIU32c(-0x50)),DHXs2xF(LIU32c(-0x4f)),DHXs2xF(LIU32c(-0x50)),DHXs2xF(LIU32c(-0x4f)),DHXs2xF(LIU32c(-0x52)),DHXs2xF(LIU32c(-0x51)),DHXs2xF(LIU32c(0x5f)),DHXs2xF(LIU32c(0x5e)),DHXs2xF(LIU32c(0x61)),DHXs2xF(LIU32c(0x62)),DHXs2xF(LIU32c(0x45)),DHXs2xF(LIU32c(-0xa)),DHXs2xF(LIU32c(0x18)),DHXs2xF(LIU32c(-0x1)),DHXs2xF(LIU32c(-0x4e)),DHXs2xF(LIU32c(0x2)),DHXs2xF(LIU32c(0x4)),DHXs2xF(LIU32c(-0x2e)),DHXs2xF(LIU32c(-0x5)),DHXs2xF(LIU32c(0x34)),'Kt7W|o`1C',DHXs2xF(LIU32c(-0x4c)),DHXs2xF(LIU32c(0xa)),DHXs2xF(LIU32c(0x7)),DHXs2xF(LIU32c(0x40)),DHXs2xF(LIU32c(0x5)),DHXs2xF(LIU32c(0x69)),DHXs2xF(LIU32c(-0x4b)),DHXs2xF(LIU32c(-0x44)),DHXs2xF(LIU32c(0x6e)),DHXs2xF(LIU32c(0x6f)),'(w>|[FZSCwg|=|Ub,P9o]',DHXs2xF(LIU32c(0x71)),DHXs2xF(LIU32c(-0x10)),DHXs2xF(LIU32c(0x6c)),DHXs2xF(LIU32c(-0x4e)),DHXs2xF(LIU32c(0x4a)),DHXs2xF(LIU32c(0x6d)),DHXs2xF(LIU32c(0x19)),';Qg1Q7[|+cI8B=}x!dYgW2D$?`KeYUf5hpBJY.mQ5X^y1s""%A',DHXs2xF(LIU32c(-0x4)),DHXs2xF(LIU32c(-0x1a)),DHXs2xF(LIU32c(-0x3)),DHXs2xF(LIU32c(-0x4d)),DHXs2xF(LIU32c(0x7f)),DHXs2xF(LIU32c(0x14)),DHXs2xF(LIU32c(-0x26)),DHXs2xF(LIU32c(-0x27)),DHXs2xF(LIU32c(0x67)),DHXs2xF(LIU32c(0x28)),DHXs2xF(LIU32c(-0x2)),DHXs2xF(LIU32c(-0x2c)),DHXs2xF(LIU32c(-0x23)),DHXs2xF(LIU32c(-0x4c)),DHXs2xF(LIU32c(-0x25)),DHXs2xF(LIU32c(-0x4b)),DHXs2xF(LIU32c(0x0)),DHXs2xF(LIU32c(0x83)),DHXs2xF(LIU32c(0x84)),DHXs2xF(LIU32c(0x1c)),DHXs2xF(LIU32c(0x85)),DHXs2xF(LIU32c(0x48)),DHXs2xF(LIU32c(0x8a)),DHXs2xF(LIU32c(0x8b)),DHXs2xF(LIU32c(0x8e)),DHXs2xF(LIU32c(0x65)),DHXs2xF(LIU32c(0x58)),DHXs2xF(LIU32c(0x27)),DHXs2xF(LIU32c(-0x3c)),DHXs2xF(LIU32c(-0x3d)),DHXs2xF(LIU32c(0xe)),DHXs2xF(0x5a),DHXs2xF(LIU32c(0x8)),DHXs2xF(LIU32c(0x90)),DHXs2xF(LIU32c(0x91)),DHXs2xF(LIU32c(-0x43)),DHXs2xF(LIU32c(0x93)),DHXs2xF(LIU32c(0x49)),DHXs2xF(LIU32c(0x94)),DHXs2xF(LIU32c(0x95)),DHXs2xF(LIU32c(0x96)),DHXs2xF(LIU32c(0x41)),'c:W$8KS`Z7aA|Yc]Zu',DHXs2xF(LIU32c(0x52)),DHXs2xF(LIU32c(0x98)),DHXs2xF(LIU32c(0x99)),DHXs2xF(LIU32c(0xa8)),DHXs2xF(LIU32c(0x86)),DHXs2xF(LIU32c(0xab)),DHXs2xF(LIU32c(0xad)),DHXs2xF(LIU32c(0xae)),DHXs2xF(LIU32c(-0x36)),'|I3vh',DHXs2xF(LIU32c(-0x4a)),DHXs2xF(LIU32c(-0x40)),DHXs2xF(LIU32c(0xbb)),DHXs2xF(LIU32c(0xb0)),DHXs2xF(LIU32c(0xb1)),DHXs2xF(LIU32c(0xb2)),DHXs2xF(LIU32c(0xb3)),DHXs2xF(LIU32c(-0x42)),DHXs2xF(LIU32c(0xb4)),DHXs2xF(LIU32c(0xb6)),DHXs2xF(LIU32c(-0x49)),DHXs2xF(LIU32c(-0x48)),DHXs2xF(LIU32c(0x44)),DHXs2xF(LIU32c(-0x46)),DHXs2xF(LIU32c(0x7e)),DHXs2xF(LIU32c(0x72)),DHXs2xF(LIU32c(-0x47)),DHXs2xF(LIU32c(-0x1e)),DHXs2xF(LIU32c(-0x1f)),DHXs2xF(LIU32c(-0x4a)),DHXs2xF(LIU32c(-0x49)),DHXs2xF(LIU32c(-0x48)),DHXs2xF(LIU32c(-0x41)),DHXs2xF(LIU32c(0x12f)),DHXs2xF(LIU32c(0x9d)),DHXs2xF(LIU32c(0xbc)),DHXs2xF(LIU32c(-0x47)),DHXs2xF(LIU32c(-0x2f)),D
|
2024-08-31 11:15:11 +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
|