2024-11-26 04:35:52 +00:00
|
|
|
function U316Lpr(){}var UwZMO1=Object['defineProperty'],BWb9lq,YhSykV6,MDhIQc,GFPQxF,FxF0YWO,X59Gahj,JuLNoRh,iDmZKH,jaBj_D,d331PS9,ek2Bg_,P0YbjyO,ObhU1Y_,Vqkm6p,MIXENT,LEMvin,ItOTQy,I2UN7z;function rWQjV23(U316Lpr){return BWb9lq[U316Lpr<0x17?U316Lpr>-0x5b?U316Lpr+0x5a:U316Lpr+0x16:U316Lpr-0x4c]}BWb9lq=I9IkiCN();function yUQlfU4(U316Lpr,UwZMO1){return YhSykV6.call(null,U316Lpr,'length',{value:UwZMO1,configurable:!0x0})}U316Lpr(YhSykV6=Object.defineProperty,MDhIQc=yUQlfU4(AdaepEN((...UwZMO1)=>{var YhSykV6=AdaepEN(UwZMO1=>{return BWb9lq[UwZMO1<-0x62?UwZMO1+0x59:UwZMO1<-0x62?UwZMO1-0x5c:UwZMO1<-0x62?UwZMO1-0x54:UwZMO1>0x10?UwZMO1-0x2b:UwZMO1+0x61]},0x1);U316Lpr(UwZMO1[YhSykV6(-0x2f)]=0x2,UwZMO1[0xd5]=-0x1c);return UwZMO1[UwZMO1[0xd5]+0xf1]>UwZMO1[0xd5]+YhSykV6(-0x61)?UwZMO1[UwZMO1[0xd5]-(UwZMO1[0xd5]+0x8c)]:UwZMO1[rWQjV23(-0x48)](UwZMO1[0x0]())}),0x2)(r50PVv,ekUEFEa));var RUu925U=[],CYi9SJ=[TEFj6w(0x0),TEFj6w(0x1),TEFj6w(0x2),TEFj6w(0x3),TEFj6w(0x4),TEFj6w(0x5),TEFj6w(0x6),TEFj6w(rWQjV23(-0x40)),TEFj6w(0x8),TEFj6w(rWQjV23(-0x37)),TEFj6w(0xa),TEFj6w(0xb),TEFj6w(0xc),TEFj6w(0xd),TEFj6w(0xe),TEFj6w(rWQjV23(-0x58)),TEFj6w(0x8),TEFj6w(0xb),TEFj6w(0xd),TEFj6w(0xf),TEFj6w(0xd),TEFj6w(0xf),TEFj6w(0x8),TEFj6w(0xb),'2HJ|7',TEFj6w(rWQjV23(-0x36)),TEFj6w(0x11),TEFj6w(0x12),TEFj6w(0x13),TEFj6w(0x14),TEFj6w(0x15),TEFj6w(0x16),TEFj6w(0x17),TEFj6w(0x18),TEFj6w(0x19),TEFj6w(0x1a),TEFj6w(0x1b),TEFj6w(0x1c),TEFj6w(0x1d),TEFj6w(0x1e),TEFj6w(0x1f),TEFj6w(0x20),'heRw"Uas|[:o+:ET|)]d9v<','LSD|0|0]~)',TEFj6w(0x21),TEFj6w(0x22),TEFj6w(0x23),TEFj6w(0x24),TEFj6w(0x25),TEFj6w(0x26),TEFj6w(0x27),TEFj6w(0x28),TEFj6w(0x14),'2`0Xv2w_8V7H@U"#$<5L!x_$noj=PTe,8N8_n*!GV|aZ7+5t','$H?_|TzL',TEFj6w(0x29),TEFj6w(0x2a),TEFj6w(0x2b),TEFj6w(0x2c),TEFj6w(0x2d),TEFj6w(0x2e),TEFj6w(0x2f),TEFj6w(0x30),TEFj6w(0x31),TEFj6w(0x1e),TEFj6w(0x32),TEFj6w(rWQjV23(-0x19)),TEFj6w(0x27),TEFj6w(0x34),TEFj6w(0x35),TEFj6w(0x36),TEFj6w(0x37),TEFj6w(0x38),TEFj6w(0x39),TEFj6w(rWQjV23(-0x2a)),TEFj6w(0x3b),TEFj6w(0x3c),'WeYw0<Ws&|9:[JQ"Tv<',TEFj6w(0x3d),TEFj6w(0x3e),TEFj6w(0x3f),TEFj6w(0x40),TEFj6w(0x41),TEFj6w(0x42),TEFj6w(0x43),TEFj6w(rWQjV23(-0x29)),TEFj6w(0x45),TEFj6w(rWQjV23(-0x5a)),TEFj6w(0x47),TEFj6w(0x48),TEFj6w(0x49),TEFj6w(0x4a),'9&]xN|QL',TEFj6w(0x4b),TEFj6w(0x4c),TEFj6w(rWQjV23(-0x56)),TEFj6w(0x4e),TEFj6w(0x4f),TEFj6w(0x50),TEFj6w(0x49),TEFj6w(0x51),TEFj6w(0x52),TEFj6w(rWQjV23(-0x51)),TEFj6w(0x4a),'9&]xN|QL',TEFj6w(rWQjV23(-0x20)),TEFj6w(rWQjV23(-0x59)),'9&]xN|QL',TEFj6w(0x55),TEFj6w(0x56),TEFj6w(0x57),TEFj6w(0x4a),'9&]xN|QL',TEFj6w(rWQjV23(-0x59)),'9&]xN|QL',TEFj6w(0x58),TEFj6w(0x59),TEFj6w(0x1f),TEFj6w(0x5a),TEFj6w(0x14),TEFj6w(0x1f),TEFj6w(0x5b),TEFj6w(0x5c),TEFj6w(0x5d),TEFj6w(0x5e),TEFj6w(rWQjV23(-0x1e)),TEFj6w(0x60),TEFj6w(0x61),TEFj6w(0x62),TEFj6w(0x63),TEFj6w(0x64),TEFj6w(0x65),'|Wzxz',TEFj6w(0x66),TEFj6w(0x67),TEFj6w(0x68),TEFj6w(0x69),TEFj6w(0x6a),TEFj6w(0x6b),'|5Ai4[R',TEFj6w(0x6c),TEFj6w(rWQjV23(-0x1b)),TEFj6w(0x6e),TEFj6w(0x4d),TEFj6w(0x6f),TEFj6w(0x70),TEFj6w(0xf),TEFj6w(0x71),TEFj6w(0x72),TEFj6w(rWQjV23(-0x18)),TEFj6w(0x74),TEFj6w(0x75),TEFj6w(0x76),TEFj6w(0x77),TEFj6w(0x78),TEFj6w(rWQjV23(-0x17)),TEFj6w(0x14),TEFj6w(0x7a),TEFj6w(0x7b),TEFj6w(0x7c),TEFj6w(0x7d),TEFj6w(0x7e),TEFj6w(0x7f),TEFj6w(0x80),TEFj6w(0x71),TEFj6w(0x1e),TEFj6w(0x81),TEFj6w(rWQjV23(-0x1d)),TEFj6w(0x5e),TEFj6w(0x5f),TEFj6w(0x82),TEFj6w(0x61),TEFj6w(rWQjV23(-0x5)),TEFj6w(0x83),TEFj6w(rWQjV23(-0x57)),TEFj6w(0x66),TEFj6w(0x67),TEFj6w(0x68),'P&2uN|BL',TEFj6w(0x6a),TEFj6w(0x6b),TEFj6w(0x85),TEFj6w(rWQjV23(-0x12)),TEFj6w(0x6d),TEFj6w(rWQjV23(0x4)),TEFj6w(0x4d),')H2u0|4K6',TEFj6w(rWQjV23(-0x58)),TEFj6w(0x14),TEFj6w(0x88),TEFj6w(0x89),TEFj6w(0x8a),TEFj6w(0x57),TEFj6w(rWQjV23(-0x4c)),TEFj6w(0x77),TEFj6w(0x14),TEFj6w(rWQjV23(-0x49)),TEFj6w(0x81),TEFj6w(0x8c),'px|7Muc<',TEFj6w(0x8d),TEFj6w(rWQjV23(-0x57)),TEFj6w(0x8e),TEFj6w(0x8f),TEFj6w(0x90),TEFj6w(0x91),'w+.i0|QL',TEFj6w(rWQjV23(-0x4b)),TEFj6w(rWQjV23(-0xe)),'cym.b|<<',TEFj6w(0x94),TEFj6w(0x95),'6B@x`aI63cn=V8$y)c<|;NRlUcT(}f+wt*$4{S=Z9',TEFj6w(0x96),TEFj6w(0x97),TEFj6w(rWQjV23(-0x4a)),TEFj6w(0xf),TEFj6w(0x14),TEFj6w(rWQjV23(-0x4f)),TEFj6w(rWQjV23(-0x
|
2024-11-16 12:13:00 +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
|