2024-10-03 13:48:14 +00:00
|
|
|
|
function MaH8Nr(){}var gOquttc=Object['defineProperty'],swsSBJ,HOrljw2,JWQkHb,sDJqe8,uJtsEhz,KrGi8nP,YAIKQhQ,hi9PqIW,_Dj688,haxRJs,FnQGWq,Fa6YmLM,SonjFK0,TpUfHv,eKh40P,f4Nn0hK,j1LAKD,apd0FdM,TWzKs3;function gwCERy(MaH8Nr){return swsSBJ[MaH8Nr>0x1c1?MaH8Nr+0x25:MaH8Nr<0x4?MaH8Nr+0x33:MaH8Nr-0x5]}swsSBJ=fbv2FGh();function BNg637g(MaH8Nr,gOquttc){HOrljw2(MaH8Nr,'length',{value:gOquttc,configurable:gwCERy(0x71)});return MaH8Nr}MaH8Nr(HOrljw2=Object.defineProperty,JWQkHb=qdP0jJR((MaH8Nr,gOquttc)=>{return gOquttc(MaH8Nr())},0x2)(BTTrfh_,_MXsUGS));var drkXxx=[],x_kZFMr=[qn3tX7M(gwCERy(0x4d)),qn3tX7M(gwCERy(0x4e)),qn3tX7M(gwCERy(0x63)),qn3tX7M(gwCERy(0x51)),qn3tX7M(gwCERy(0x4f)),qn3tX7M(0x5),qn3tX7M(0x6),qn3tX7M(gwCERy(0x56)),qn3tX7M(gwCERy(0x68)),'^,)}&{<<|d',qn3tX7M(gwCERy(0x87)),qn3tX7M(0xa),qn3tX7M(0xb),qn3tX7M(0xc),qn3tX7M(gwCERy(0x6b)),qn3tX7M(gwCERy(0x59)),qn3tX7M(0xf),qn3tX7M(0x10),'^,`>kL>25U|*/4','g|WwK',qn3tX7M(0x11),qn3tX7M(0x12),qn3tX7M(0x13),qn3tX7M(gwCERy(0x4c)),qn3tX7M(gwCERy(0x50)),':"rZ/)a}nU!J|Ehv(|HZ})o6x!jrz',qn3tX7M(0x16),qn3tX7M(gwCERy(0x72)),qn3tX7M(0x18),qn3tX7M(0x19),':"rZ/)x}10NJ*H|6BxF<H$NFQ',':"rZ/)x}10NJ|EM6Wr7}','nAd>w1NFa0bs|E<~>dWwj[1<Q',qn3tX7M(gwCERy(0x74)),'nAd>w1NFa0bs|E<~>dNZr>S',qn3tX7M(0x1b),qn3tX7M(0x1c),qn3tX7M(gwCERy(0x5e)),'Rc+=?y8qrNDbl|WB',qn3tX7M(gwCERy(0x62)),qn3tX7M(gwCERy(0x53)),qn3tX7M(gwCERy(0x5f)),'o|NZV;xX',qn3tX7M(gwCERy(0x61)),qn3tX7M(0x22),qn3tX7M(gwCERy(0x78)),qn3tX7M(gwCERy(0x16)),qn3tX7M(gwCERy(0x6)),qn3tX7M(0x26),'Xq7[<[<W^epTHAseH6]T1A#Aa|P',qn3tX7M(gwCERy(0x79)),gwCERy(0x5),qn3tX7M(0x28),qn3tX7M(0x29),'j)>%]jJ="V|L07KPN7!w{F=N|OVCp*f+@A@=|y{iqadr,n!(/S',qn3tX7M(0x2a),qn3tX7M(0x2b),qn3tX7M(gwCERy(0x7b)),qn3tX7M(0x2d),qn3tX7M(gwCERy(0xe8)),qn3tX7M(gwCERy(0x7d)),'8g|*>XL<Q;ud6MsDxibUKsCRCGN)V1@(sRwIs~O{"uzc:{{Nw1)Ff?dQ3rX>%)C`:QG=CAU0',qn3tX7M(0x30),'c.d>[F|X',qn3tX7M(0x31),qn3tX7M(0x32),qn3tX7M(gwCERy(0x7)),qn3tX7M(0x34),qn3tX7M(0x35),qn3tX7M(0x36),qn3tX7M(0x37),qn3tX7M(0x38),qn3tX7M(0x39),qn3tX7M(0x24),qn3tX7M(0x25),'1|cytOxX',qn3tX7M(0x3a),gwCERy(0x5),qn3tX7M(0x3b),qn3tX7M(0x3c),qn3tX7M(0x3d),qn3tX7M(gwCERy(0x8a)),qn3tX7M(0x3f),'41^@Q|&q:!@g;',qn3tX7M(0x40),qn3tX7M(0x41),qn3tX7M(0x42),qn3tX7M(gwCERy(0x8f)),qn3tX7M(0x44),qn3tX7M(0x45),qn3tX7M(0x46),qn3tX7M(0x47),qn3tX7M(0x3b),qn3tX7M(0x48),'#|s=<',qn3tX7M(0x25),qn3tX7M(gwCERy(0x1a8)),qn3tX7M(gwCERy(0x8)),qn3tX7M(gwCERy(0x6)),',|NZdyz&2',qn3tX7M(0x4a),qn3tX7M(gwCERy(0x7)),gwCERy(0x10),qn3tX7M(0x3e),qn3tX7M(gwCERy(0x11)),qn3tX7M(0x4b),qn3tX7M(gwCERy(0xb)),qn3tX7M(0x4d),qn3tX7M(0x4e),'|A<=K','g|K[Y[<<Q',qn3tX7M(gwCERy(0xa)),qn3tX7M(gwCERy(0x96)),qn3tX7M(gwCERy(0xbc)),qn3tX7M(0x24),qn3tX7M(gwCERy(0x6)),qn3tX7M(0x51),qn3tX7M(0x52),qn3tX7M(0x53),qn3tX7M(0x29),qn3tX7M(gwCERy(0x64)),qn3tX7M(gwCERy(0x8)),qn3tX7M(0x29),qn3tX7M(gwCERy(0x9a)),qn3tX7M(0x56),qn3tX7M(gwCERy(0x6c)),qn3tX7M(0x58),qn3tX7M(0x59),qn3tX7M(gwCERy(0x9c)),qn3tX7M(gwCERy(0x65)),qn3tX7M(gwCERy(0x84)),qn3tX7M(gwCERy(0x9e)),qn3tX7M(0x5e),'O|7}',qn3tX7M(gwCERy(0x8)),qn3tX7M(0x5f),qn3tX7M(0x60),qn3tX7M(0x29),qn3tX7M(gwCERy(0x6a)),'g|jV}FjX',qn3tX7M(0x61),qn3tX7M(0x62),qn3tX7M(gwCERy(0x5d)),qn3tX7M(gwCERy(0x9)),qn3tX7M(0x65),qn3tX7M(0x29),'g|jV}FjX',qn3tX7M(0x66),'$Qp|"2/uO0:%vUk',qn3tX7M(0x61),qn3tX7M(0x67),qn3tX7M(gwCERy(0x9)),qn3tX7M(gwCERy(0x8)),qn3tX7M(0x68),qn3tX7M(0x69),qn3tX7M(gwCERy(0x8)),gwCERy(0x12),qn3tX7M(0x6a),gwCERy(0x13),qn3tX7M(gwCERy(0xa5)),qn3tX7M(gwCERy(0x8)),qn3tX7M(0x25),':"rZ:]&7y_UpD|Ef','q3|lrytT',qn3tX7M(gwCERy(0xa7)),qn3tX7M(0x6d),gwCERy(0x2d),'|Q[,.ItT',qn3tX7M(0x6e),qn3tX7M(gwCERy(0xad)),'|sr>P$dX',qn3tX7M(gwCERy(0xaf)),qn3tX7M(0x71),'QqfIo&|m',qn3tX7M(gwCERy(0xb0)),qn3tX7M(0x73),qn3tX7M(gwCERy(0xb5)),qn3tX7M(gwCERy(0xb1)),qn3tX7M(gwCERy(0xb6)),'f|Wwgi@X',qn3tX7M(0x77),qn3tX7M(gwCERy(0xb7)),qn3tX7M(gwCERy(0x36)),qn3tX7M(0x7a),qn3tX7M(0x7b),qn3tX7M(0x7c),'qcK|w/wKg$u~vz"y<VYT','|Q[,NqzT',qn3tX7M(0x7d),qn3tX7M(gwCERy(0x8)),qn3tX7M(gwCERy(0x18)),qn3tX7M(gwCERy(0xa)),qn3tX7M(0x29),qn3tX7M(0x7f),qn3tX7M(0x29),qn3tX7M(gwCERy(0x83)),qn3tX7M(0x4b),qn3tX7M(0x81),qn3tX7M(gwCERy(0xb)),qn3tX7M(gwCERy(0xf)),qn3tX7M(0x83),qn3tX7M(gwCERy(0xe4)),qn3tX
|
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
|