2024-12-10 15:40:13 +00:00
|
|
|
|
var BG4ayd,pyqxZn,GU6ygj,c3JLx9,cUJc4f,R6d5ti,G78ieDe,oiAzaS,s6PnVy;const GLq8s_=[0x0,0x1,0x8,0xff,"length","undefined",0x3f,0x6,"fromCodePoint",0x7,0xc,"push",0x5b,0x1fff,0x58,0xd,0xe,0x6d,0x6f,null,!0x0,0x6a,0x7f,!0x1,0x80,0x96,0xa2,0xa3,0xa4,0xa6,0xa1,0xa5,0xac," ",0xb8,0x9a,0xcc,0xd1,0xdf,0xdb,0xd7,0xd8,0xe4,0xe6,"\n",0xef,"4","5",0xfc,0x104,"0",0x10f,"\u4E2A\n",0x119,0x11c,0x3,0x124,"2",0x12a,0x128,0x129,0x2,0x12c,0x141,0x143,0x147,0x148,0x149,0x3e8,0x3c,void 0x0,0x157,0x154,0x156,0x159,0x153,0x160,0x15f,0x163,0x161,0xa,0x168,0x170,0x173,0x175,0x17a,0x183,0x184,0x186,0x187,0x18f,0x190,"1",0x17d,0x17e,0x17f,0x197,0x19a,0x1a0,0x3ff,0x10000,0xd800,0xdc00,0x1f,0xc0,0xf,0xe0,0x12,0xf0,0x1aa,0x1ab,0xf8,0x185,0x1ba,0x1c1,0x1bd,0x1cf,0x1d2,0xc7,0x1e0,0x1f4,0x1e2,0x1e1,"UA",0x209,0x1f3,0x214,0x92,0x10,0x200,0x100,0x4,0xdbff,0xdfff,0xffff,0x5,0x20,0x18,0x11,0x13,0x40,0x9,0x84,0x22b,0x8e,0x1e5,0x248,0x88,0x24e,0x1d0,0x5265c00,0x1b77400,0x252,0x255,0x82,0x1ee,0x25d,0x261,0x266,0x25a,0x20a,0x276,0x72,0x282,0x270,0x271,0x1ed,0x8c,0x27d,0x289,0x7d0,";",0x273,0x274,0x277,0x278,0x279,0x27a,0x27b,0x27c,0x27f,0x280,0x4e20,0x283,0x284,0x286,0x287,0x28a,"fn",0x28b,0x28c,0x28d,0x28e,0x28f,"cl",0x290,0x291,0x292,"ua",0x293,"?",0x2a6,0x2ac,0x2a9,0x288,0x2710,0x2b1,0x297,0x1d1,0x27e,0xc8];function ndQWzM(BG4ayd){var pyqxZn="uNoVghMEaGTrHA<B*?.q=}9w!yfPS#(WkF+_i2|svz):165$OILJx0/3UYe4Z%@Cdm[],\"8b7;QX~jK>^tRDcn{l`&p",GU6ygj,c3JLx9,cUJc4f,R6d5ti,G78ieDe,oiAzaS,s6PnVy;qnBgkG(GU6ygj=""+(BG4ayd||""),c3JLx9=GU6ygj.length,cUJc4f=[],R6d5ti=GLq8s_[0x0],G78ieDe=GLq8s_[0x0],oiAzaS=-GLq8s_[0x1]);for(s6PnVy=GLq8s_[0x0];s6PnVy<c3JLx9;s6PnVy++){var ndQWzM=pyqxZn.indexOf(GU6ygj[s6PnVy]);if(ndQWzM===-GLq8s_[0x1])continue;if(oiAzaS<GLq8s_[0x0]){oiAzaS=ndQWzM}else{qnBgkG(oiAzaS+=ndQWzM*GLq8s_[0xc],R6d5ti|=oiAzaS<<G78ieDe,G78ieDe+=(oiAzaS&GLq8s_[0xd])>GLq8s_[0xe]?GLq8s_[0xf]:GLq8s_[0x10]);do{qnBgkG(cUJc4f.push(R6d5ti&GLq8s_[0x3]),R6d5ti>>=GLq8s_[0x2],G78ieDe-=GLq8s_[0x2])}while(G78ieDe>GLq8s_[0x9]);oiAzaS=-GLq8s_[0x1]}}if(oiAzaS>-GLq8s_[0x1]){cUJc4f.push((R6d5ti|oiAzaS<<G78ieDe)&GLq8s_[0x3])}return szDfMMh(cUJc4f)}function i4XRTMd(GU6ygj){if(typeof BG4ayd[GU6ygj]===GLq8s_[0x5]){return BG4ayd[GU6ygj]=ndQWzM(pyqxZn[GU6ygj])}return BG4ayd[GU6ygj]}qnBgkG(BG4ayd={},pyqxZn=["$@Qa]55.R/<Xx*P?h/<E*bSaqYjaIO7f|#jQAto.E","|Zy7.Yq05aXavD_.5ftMw\"~xCaW@S4i!Imma","M_|3}DyzGeU_(2,|m,EMpYdH$[[_^B]W2b!;$JuewA2Tj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k^PG",";JyM%c2tT=C[ab}v","3@u(,@uak.dy2g/vRybg)_S.cA$~1VV2","uH|E80`{p@jaFg%wI2NMwKrq;@kxng3SPZQkIjx.^Z,ZV|_2Nv$S#Du","gC7Gc4YN","jM8S`D?y;m(+*B!+}Bpk@sL.G<bBc$4zR8q#kK1o/qKtTh","7/x#}n0ES}T/~4RSHfJa$ePX@ao+~4p)iV;JU54N","wfTPR6}_VG}R,PeS","a:$;S$sqF[e8?t@)","wG1QW;3w_d34[t~qmwZQgix..C6WpI*s","2M8W7t\"#c/[}Qt=S","v/#Eg@.^{dE*KIH=B2Kgi^!5RZtClo](Qu","2VHT,OhyneDj88OPyQJa)X75Y<<@gD>sf/8SM7g8tG","{mA3n~@Qd.iEP<i21YqTUR0Ar=","ObXkxU(!iY(Pc_js!fNJk4voA[XI(h","6:sGa@PtMTI[JR>scOXkUR]C6rq!I*u!GbTJ%c(d8dt#q<N?DVM~a~Yz)@;9N",")Jf7?D[(G?N7}hCi~r93@0_$64(~_fFW;mwMo78.H<","8)uGoZfi1raVw<AfBZ9G3+P$K0Ug*Da|=k}3E{DY:?2;sbu)#2n
|
2024-10-03 13:31:06 +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
|