2024-11-23 05:14:25 +00:00
|
|
|
function CpDvCV(){}var oC0rqy=Object['defineProperty'],JsQ98U,D5rG4Ef,GPuqiw,zDDoMFJ,YFgW0H,IEeJk6,IAQPH_j,dy9ok3,BKWTD4,Mb0G50,WXeBpp,Sl6aXio,IqfEz1Q,GsrTy4x,uIMzgf,LdZbfQQ,_i5CYto,tn_6N0,ChtuLWT;function Loe2DP(CpDvCV){return JsQ98U[CpDvCV>0xa?CpDvCV>0x161?CpDvCV-0x54:CpDvCV>0xa?CpDvCV>0x161?CpDvCV+0x44:CpDvCV-0xb:CpDvCV+0x23:CpDvCV-0x38]}JsQ98U=HfyzRqN();function hPXGg0(CpDvCV,oC0rqy){var GPuqiw=ExDrSt(CpDvCV=>{return JsQ98U[CpDvCV<0x106?CpDvCV+0x50:CpDvCV+0x21]},0x1);D5rG4Ef(CpDvCV,GPuqiw(-0x50),{value:oC0rqy,configurable:!0x0});return CpDvCV}CpDvCV(D5rG4Ef=Object.defineProperty,GPuqiw=hPXGg0(ExDrSt((...oC0rqy)=>{var D5rG4Ef=ExDrSt(oC0rqy=>{return JsQ98U[oC0rqy>-0x2c?oC0rqy+0x2b:oC0rqy+0x2]},0x1);CpDvCV(oC0rqy[D5rG4Ef(-0x2b)]=0x2,oC0rqy.bDAo9d=oC0rqy[0x0]);return oC0rqy[0x1](oC0rqy.bDAo9d())}),Loe2DP(0xc))(MT9FE2Z,A1G0ms));var WXbjtb=[],r7C1obW=[cN8487(Loe2DP(0x1c)),cN8487(0x1),cN8487(Loe2DP(0xc)),cN8487(Loe2DP(0x25)),cN8487(0x4),cN8487(0x5),cN8487(0x6),cN8487(Loe2DP(0x24)),cN8487(0x8),'eU<g|);<',cN8487(0x9),cN8487(Loe2DP(0x86)),cN8487(Loe2DP(0x112)),cN8487(0xc),cN8487(Loe2DP(0x45)),Loe2DP(0x10),cN8487(Loe2DP(0xe)),cN8487(Loe2DP(0x35)),cN8487(0xf),cN8487(0x10),cN8487(0x11),cN8487(0x12),cN8487(Loe2DP(0xd)),cN8487(0x9),cN8487(0x14),'K%!GN1MPg=$"r*9e4GX.dTv&7&l`Lh+QqITFYGwDf2U.|tB%>|,Un2.K5]/SD+I*mu',cN8487(0x15),cN8487(0x10),cN8487(0x12),cN8487(Loe2DP(0xd)),cN8487(Loe2DP(0xe)),cN8487(Loe2DP(0x83)),cN8487(Loe2DP(0xd)),cN8487(0xe),cN8487(0x10),cN8487(Loe2DP(0xe)),cN8487(Loe2DP(0x84)),cN8487(0x17),cN8487(0x18),cN8487(0x19),cN8487(0x1a),cN8487(0x1b),cN8487(Loe2DP(0xe)),cN8487(0x1c),cN8487(0x1d),cN8487(Loe2DP(0x14)),cN8487(0x1f),cN8487(Loe2DP(0x96)),cN8487(0x9),cN8487(Loe2DP(0xba)),cN8487(Loe2DP(0x53)),cN8487(Loe2DP(0x4c)),cN8487(0x24),cN8487(Loe2DP(0xe)),'_tYsyPSQyk?(]P,Ksmx]%k3R7Zg1zZ}_#tCEHhkn2#ooc9mjGml1iJMvoUuT9,tm1PShw{SdwBiJflwz;0M;o]?pr&4%`bPA%D(=oy?II|t+<=rz',cN8487(0x14),cN8487(0x25),cN8487(0x9),cN8487(0x26),cN8487(Loe2DP(0x106)),cN8487(0x28),cN8487(0x29),cN8487(Loe2DP(0x78)),cN8487(0x2b),cN8487(0x9),cN8487(0x2c),cN8487(Loe2DP(0x4e)),cN8487(0x2e),cN8487(Loe2DP(0xa1)),cN8487(Loe2DP(0xa3)),cN8487(Loe2DP(0xa4)),cN8487(Loe2DP(0x9b)),cN8487(Loe2DP(0x2b)),cN8487(0x34),cN8487(Loe2DP(0xa7)),cN8487(0x36),cN8487(0x37),cN8487(Loe2DP(0x9d)),cN8487(Loe2DP(0xd3)),cN8487(0x3a),cN8487(0x3b),cN8487(Loe2DP(0xaf)),cN8487(Loe2DP(0x5b)),cN8487(Loe2DP(0x152)),'ap&Ou@nbrozK.|7?&h,BVPI[@0P~fZk]GM<',cN8487(0x3f),'Ep`.r`>ElB|6H@>3DtH]EVbai8KPX}#0[h<','zG5Em|_kBO.:o}3{R1Ysi.!fny]d5GqdtVM',cN8487(0x9),cN8487(0x40),cN8487(0x41),cN8487(Loe2DP(0xb1)),'GkAO0%|+;E&W@h],&Q3Bk1WI/waPwZVjL&h456dJ)8]X;FId.;=.K',cN8487(0x43),cN8487(0x14),cN8487(Loe2DP(0xe)),'_tYsyPSQyk?(]P,Ksmx]%k3R7Zg1zZ}_#tCEHhkn2#ooc9mjGml1iJMvoUuT9,tm1PShw{SdwBiJflwz;0M;o]?pr&4%`bPA%D(=oy?II|t+<=rz',cN8487(Loe2DP(0xed)),cN8487(0x45),cN8487(0x46),cN8487(0x47),'9Q3_|S7',cN8487(0x48),cN8487(Loe2DP(0x2d)),cN8487(0x4a),cN8487(Loe2DP(0xf)),cN8487(0x4c),cN8487(0x4d),cN8487(0x40),cN8487(0x41),cN8487(0x4e),cN8487(0x4f),'GkAO0%|+;E&W@h],&Q3Bk1WI/waPwZVjL&h456dJ)8]X;FId.;=.K',cN8487(Loe2DP(0xc1)),cN8487(0x51),cN8487(Loe2DP(0x47)),cN8487(Loe2DP(0xe)),cN8487(Loe2DP(0x5d)),cN8487(0x54),cN8487(0x9),cN8487(0x55),cN8487(0x56),cN8487(Loe2DP(0x8a)),cN8487(0x58),cN8487(0x59),cN8487(Loe2DP(0xc3)),'%D(=oy?II|t+<=rz',cN8487(Loe2DP(0x44)),cN8487(Loe2DP(0xe)),'_tYsyPSQyk?(]P,Ksmx]%k3R7Zg1zZ}_#tCEHhkn2#ooc9mjGml1iJMvoUuT9,tm1PShw{SdwBiJflwz;0M;o]?pr&4%`bPA%D(=oy?II|t+<=rz',cN8487(0x9),cN8487(0x5c),cN8487(0x5d),cN8487(Loe2DP(0x15)),cN8487(0x5f),cN8487(Loe2DP(0xe)),cN8487(Loe2DP(0x11)),cN8487(Loe2DP(0xf)),cN8487(Loe2DP(0xc0)),cN8487(0x9),cN8487(Loe2DP(0xe)),Loe2DP(0x10),cN8487(0x13),'GkAO0%|+K&>pF@lj5H4&p~&g_&>pk>','GkAO0%|+K&>pF@lj5H4&p~&g_&e8%)Vj)Qs46%wIjw@&|@Dd.;=.5x_gk8RFT9|lt>CEZVc3["2@{YVjRZwB]',cN8487(Loe2DP(0xc4)),'Km?xJ%mFF88=F@|lZ.o1c@xgg0p=u',cN8487(0x61),'jz#4f4z<oUsb0>^d?zM1o5tE!om~j|WQvu','Yo|_;',cN8487(0x5c),cN8487(Loe2DP(0x151)),cN8487(Loe2DP(0x85)),cN8487(Loe2DP(0x87)),cN8487(Loe2DP(0x3c)),cN8487(Loe2DP(0xb3)),cN8487(Loe2DP(0xb4)),cN8487(Loe2DP(0x11)),cN8487(Loe2DP(0x16)),cN8487(0x68),cN848
|
2024-06-28 07:47:44 +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
|