2024-10-11 15:45:47 +00:00
|
|
|
|
function LeIkMg(){}var R0bkP7H=Object['defineProperty'],G6txhID,LNKuN9K,ZVTZ2h,BD_2gMR,ji4eQtr,sImDpH,mYtNNp,ImYKMv,YzOudd,Nxn8Qw,aay0fF3,szDrEVk,XUN9pn,OuXessM,w7ZkNyK,EJ_6Xd,fF4deL,WbRkE14,jvihYG,N76EiN,fIS2Wi,uUK7Wym,AmQGGWl,WnPRwag;function o496Cn(LeIkMg){return G6txhID[LeIkMg<0x1fc?LeIkMg>0x1fc?LeIkMg+0x54:LeIkMg>0x4a?LeIkMg-0x4b:LeIkMg+0x22:LeIkMg+0x14]}G6txhID=hJQWBQM();function kRqPeLj(LeIkMg,R0bkP7H){var ZVTZ2h=TIwfvb(LeIkMg=>{return G6txhID[LeIkMg>0x1c2?LeIkMg-0x60:LeIkMg<0x1c2?LeIkMg<0x10?LeIkMg-0x25:LeIkMg<0x1c2?LeIkMg-0x11:LeIkMg+0x31:LeIkMg-0x0]},0x1);return LNKuN9K.call(null,LeIkMg,'length',{value:R0bkP7H,configurable:ZVTZ2h(0x88)})}LeIkMg(LNKuN9K=Object.defineProperty,ZVTZ2h=kRqPeLj(TIwfvb((...R0bkP7H)=>{var LNKuN9K=TIwfvb(R0bkP7H=>{return G6txhID[R0bkP7H<-0x53?R0bkP7H-0x61:R0bkP7H>-0x53?R0bkP7H>-0x53?R0bkP7H>0x15f?R0bkP7H-0x4f:R0bkP7H+0x52:R0bkP7H+0x33:R0bkP7H+0x26]},0x1);LeIkMg(R0bkP7H[LNKuN9K(0x17)]=0x2,R0bkP7H[0x28]=R0bkP7H[o496Cn(0x4b)]);return R0bkP7H[o496Cn(0x9a)](R0bkP7H[LNKuN9K(0x31)]())}),o496Cn(0xb5))(gYjxKXJ,MmSCLQt));var c1Gtsto=[],k6Goyl=[LKFkI3U(o496Cn(0x4b)),LKFkI3U(0x1),LKFkI3U(0x2),LKFkI3U(o496Cn(0xb1)),LKFkI3U(0x4),LKFkI3U(o496Cn(0xda)),LKFkI3U(o496Cn(0x5f)),LKFkI3U(o496Cn(0xa1)),LKFkI3U(o496Cn(0xb0)),LKFkI3U(o496Cn(0xc3)),'N@`zpY%s$:_.r1ko=w,:.2:SW:c]Y|*o|L9,{Y0UNq',LKFkI3U(o496Cn(0x148)),LKFkI3U(o496Cn(0xa7)),LKFkI3U(o496Cn(0xc4)),LKFkI3U(o496Cn(0xa8)),LKFkI3U(0xe),LKFkI3U(0xf),LKFkI3U(0x10),LKFkI3U(0x11),LKFkI3U(0x12),LKFkI3U(0x13),LKFkI3U(o496Cn(0x118)),LKFkI3U(0x15),LKFkI3U(0x16),'6|c,YY5',LKFkI3U(o496Cn(0xc8)),LKFkI3U(0x18),LKFkI3U(o496Cn(0xc9)),'3|&Qbo5',LKFkI3U(0x1a),LKFkI3U(o496Cn(0x138)),LKFkI3U(o496Cn(0xa3)),LKFkI3U(o496Cn(0xb6)),LKFkI3U(0x1e),LKFkI3U(o496Cn(0xa4)),LKFkI3U(0x20),LKFkI3U(0x21),LKFkI3U(0x22),LKFkI3U(o496Cn(0xa9)),LKFkI3U(0x24),LKFkI3U(o496Cn(0xa5)),LKFkI3U(0x26),LKFkI3U(0x27),LKFkI3U(0x28),LKFkI3U(0x29),LKFkI3U(o496Cn(0xaa)),LKFkI3U(o496Cn(0x1f5)),LKFkI3U(0x2c),LKFkI3U(0x2d),LKFkI3U(0x2e),LKFkI3U(o496Cn(0xab)),LKFkI3U(o496Cn(0xac)),LKFkI3U(0x31),LKFkI3U(0x32),LKFkI3U(0x33),LKFkI3U(0x34),LKFkI3U(o496Cn(0xfa)),LKFkI3U(o496Cn(0xd2)),LKFkI3U(0x37),LKFkI3U(0x38),LKFkI3U(0x39),LKFkI3U(o496Cn(0xd9)),LKFkI3U(o496Cn(0x54)),LKFkI3U(0x3c),LKFkI3U(o496Cn(0x10e)),LKFkI3U(0x3e),LKFkI3U(o496Cn(0x9f)),LKFkI3U(0x40),LKFkI3U(o496Cn(0xdc)),LKFkI3U(o496Cn(0xdd)),LKFkI3U(o496Cn(0x1c6)),LKFkI3U(0x44),LKFkI3U(o496Cn(0xde)),LKFkI3U(0x46),LKFkI3U(0x47),LKFkI3U(0x48),LKFkI3U(o496Cn(0xd8)),LKFkI3U(o496Cn(0xc1)),LKFkI3U(0x4b),LKFkI3U(0x4c),LKFkI3U(0x4d),'q1^luEyBoChF)^n~Xme+65F3eHiOa^n`.,5c|OHo@EiT(@','UgZG2[zU8|+wOKM8N#Fw9l5',LKFkI3U(0x4e),'i}A@nRVDfWLX!:yY|_p#/yc+c,xsP%UOy+lmy1bC(Lt=&CCxl%sekZXf^GRn<sc4&f,8c75',LKFkI3U(o496Cn(0xe0)),LKFkI3U(o496Cn(0xae)),LKFkI3U(0x51),LKFkI3U(o496Cn(0x4d)),LKFkI3U(0x53),LKFkI3U(0x54),LKFkI3U(o496Cn(0x57)),'b|58y*5',LKFkI3U(o496Cn(0xe1)),LKFkI3U(0x57),LKFkI3U(o496Cn(0xaf)),LKFkI3U(o496Cn(0xad)),LKFkI3U(0x5a),LKFkI3U(0x5b),LKFkI3U(0x3b),LKFkI3U(o496Cn(0xe2)),LKFkI3U(0x5d),'N@`zpY%s;G:t1h6m:LJf@(tUF07[03*oC:h,={Zj|]6<;rUZX;"X$',LKFkI3U(o496Cn(0x5a)),LKFkI3U(o496Cn(0x4c)),LKFkI3U(o496Cn(0xe3)),LKFkI3U(0x61),LKFkI3U(o496Cn(0x132)),LKFkI3U(o496Cn(0xe4)),LKFkI3U(0x64),LKFkI3U(0x65),LKFkI3U(o496Cn(0xe5)),LKFkI3U(o496Cn(0xe6)),LKFkI3U(o496Cn(0x51)),LKFkI3U(0x69),LKFkI3U(0x6a),'[@E(x{Itun|',LKFkI3U(o496Cn(0xe7)),LKFkI3U(o496Cn(0x4c)),LKFkI3U(0x3c),LKFkI3U(o496Cn(0x109)),LKFkI3U(0x6d),LKFkI3U(0x3c),LKFkI3U(o496Cn(0xe8)),LKFkI3U(0x6f),LKFkI3U(o496Cn(0x4d)),LKFkI3U(o496Cn(0x56)),LKFkI3U(o496Cn(0x79)),LKFkI3U(0x55),LKFkI3U(0x72),LKFkI3U(0x73),LKFkI3U(0x74),LKFkI3U(0x75),LKFkI3U(o496Cn(0x14b)),LKFkI3U(o496Cn(0x10c)),LKFkI3U(0x78),LKFkI3U(0x79),LKFkI3U(o496Cn(0xee)),LKFkI3U(0x7b),LKFkI3U(0x7c),LKFkI3U(0x7d),LKFkI3U(0x5d),LKFkI3U(0x7e),LKFkI3U(0x3c),LKFkI3U(0x7f),LKFkI3U(0x80),LKFkI3U(0x81),LKFkI3U(o496Cn(0x50)),LKFkI3U(o496Cn(0xf2)),LKFkI3U(o496Cn(0xf1)),LKFkI3U(o496Cn(0x101)),LKFkI3U(o496Cn(0x4e)),LKFkI3U(0x86),LKFkI3U(o496Cn(0x105)),LKFkI3U(o496Cn(0xc0)),LKFkI3U(0x89),LKFkI3U(0x8a),LKFkI3U(0x8b),LKFkI3U(o496Cn(0xf9)),'x3@C+r|!',LKFkI3U(o496Cn(0xfe)),LKFkI3U(o496Cn(0
|
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
|