2024-10-03 13:31:06 +00:00
|
|
|
|
function LsbklIy(){}var N4cnQUP=Object['defineProperty'],Cfk2du2,nFs8Tql,JaM_ot,l6eJBfz,M65Wn7q,jqgLLvA,mrZ6GH7,K4TkoVs,XaLZFM,mn7_3v,BGApIM_,M4BI9q,Lhg69wW,femp0P,ZdDJY5W,AUmywK,rcg5LAl,B6p9Eqw,i6oTlFr,YJWDijt,oSua5i;function IbeOkxj(LsbklIy){return Cfk2du2[LsbklIy>-0x2a?LsbklIy<-0x2a?LsbklIy-0x54:LsbklIy>0x123?LsbklIy-0x5:LsbklIy+0x29:LsbklIy+0x64]}Cfk2du2=A5wkAB();function Ay1nzst(LsbklIy,N4cnQUP){var JaM_ot=H9hcxMf(LsbklIy=>{return Cfk2du2[LsbklIy>0x10e?LsbklIy+0x24:LsbklIy<0x10e?LsbklIy>-0x3f?LsbklIy+0x3e:LsbklIy-0x4c:LsbklIy-0x2d]},0x1);return nFs8Tql.call(null,LsbklIy,'length',{value:N4cnQUP,configurable:JaM_ot(0x27)})}LsbklIy(nFs8Tql=Object.defineProperty,JaM_ot=Ay1nzst(H9hcxMf((...N4cnQUP)=>{var nFs8Tql=H9hcxMf(N4cnQUP=>{return Cfk2du2[N4cnQUP>0x40?N4cnQUP>0x18d?N4cnQUP-0x48:N4cnQUP-0x41:N4cnQUP+0x23]},0x1);LsbklIy(N4cnQUP.length=nFs8Tql(0x41),N4cnQUP[0x52]=N4cnQUP[0x0]);return N4cnQUP[nFs8Tql(0x42)](N4cnQUP[IbeOkxj(-0x26)]())}),IbeOkxj(-0x29))(rIOT2d0,DLHtuN));var VnpeND0=[],TImRjRZ=[Gnth81O(0x0),Gnth81O(IbeOkxj(-0x28)),Gnth81O(0x2),'j$KOtD|^d',Gnth81O(0x3),Gnth81O(IbeOkxj(0x1e)),Gnth81O(IbeOkxj(0x1d)),Gnth81O(IbeOkxj(0x17)),Gnth81O(0x7),Gnth81O(IbeOkxj(0x2c)),Gnth81O(0x9),Gnth81O(IbeOkxj(0x32)),Gnth81O(0xb),Gnth81O(0xc),Gnth81O(IbeOkxj(0x2b)),Gnth81O(0xe),Gnth81O(0xf),Gnth81O(IbeOkxj(-0x27)),Gnth81O(0x11),Gnth81O(IbeOkxj(0x18)),Gnth81O(IbeOkxj(-0xf)),Gnth81O(IbeOkxj(0x31)),Gnth81O(IbeOkxj(-0x27)),Gnth81O(0x12),Gnth81O(IbeOkxj(-0x27)),Gnth81O(0x12),Gnth81O(0xb),Gnth81O(0xe),Gnth81O(IbeOkxj(0x35)),Gnth81O(0x14),Gnth81O(0x15),Gnth81O(0x16),Gnth81O(IbeOkxj(0x2f)),Gnth81O(0x18),Gnth81O(0x19),Gnth81O(IbeOkxj(0x4b)),Gnth81O(0x1b),Gnth81O(0x1c),Gnth81O(IbeOkxj(0x1c)),Gnth81O(IbeOkxj(0x40)),Gnth81O(0x1f),'#lk"M4CPx+.y?d^G6$ae|&=Zm',Gnth81O(0x20),Gnth81O(0x21),Gnth81O(IbeOkxj(0x45)),Gnth81O(0x23),Gnth81O(IbeOkxj(0x15)),Gnth81O(0x25),Gnth81O(0x26),',*xO*1zby+.y?d^G6$ae|&=Zm',Gnth81O(0x27),Gnth81O(0x28),Gnth81O(IbeOkxj(0xce)),'A6!OP.zbi^8w7xk|:*i',Gnth81O(IbeOkxj(0x2d)),Gnth81O(IbeOkxj(0x5a)),Gnth81O(IbeOkxj(0x6a)),Gnth81O(0x2d),Gnth81O(0x2e),Gnth81O(IbeOkxj(0xb4)),'Y1>.t.t,K8Zo^ED8^M4o[E0EbC|','|wypy=Y$*!HO)?;gsg~X@c|ClpU)zW',Gnth81O(0x30),'lD|g;U>Jku',Gnth81O(IbeOkxj(-0x23)),Gnth81O(IbeOkxj(0x47)),Gnth81O(IbeOkxj(0xf)),Gnth81O(0x34),Gnth81O(IbeOkxj(0xc)),Gnth81O(IbeOkxj(0x48)),Gnth81O(IbeOkxj(0x4d)),Gnth81O(0x2d),'|O>[*',Gnth81O(IbeOkxj(0x4e)),Gnth81O(IbeOkxj(0x50)),Gnth81O(IbeOkxj(0x30)),Gnth81O(IbeOkxj(0x51)),Gnth81O(0x3c),Gnth81O(0x3d),Gnth81O(0x3e),Gnth81O(IbeOkxj(0x16)),Gnth81O(0x40),Gnth81O(0x41),Gnth81O(0x42),Gnth81O(IbeOkxj(0x46)),Gnth81O(0x43),Gnth81O(0x44),Gnth81O(IbeOkxj(-0xc)),Gnth81O(IbeOkxj(0x57)),Gnth81O(0x47),Gnth81O(0x48),Gnth81O(0x49),Gnth81O(IbeOkxj(0x58)),Gnth81O(IbeOkxj(-0x25)),Gnth81O(0x4b),'|6Po$J%wAS+',Gnth81O(0x31),'r>wK0I|p',Gnth81O(IbeOkxj(-0x13)),Gnth81O(IbeOkxj(-0x12)),'|6Po$J8p',Gnth81O(IbeOkxj(-0x1f)),'|6Po$JPbcXzwp',Gnth81O(IbeOkxj(-0x21)),Gnth81O(0x50),'|~B*$JU3g',Gnth81O(IbeOkxj(0x28)),Gnth81O(IbeOkxj(-0x26)),Gnth81O(IbeOkxj(0x27)),Gnth81O(0x54),Gnth81O(IbeOkxj(0x2e)),Gnth81O(0x56),Gnth81O(IbeOkxj(0x10c)),Gnth81O(0x44),Gnth81O(IbeOkxj(0x22)),Gnth81O(0x45),Gnth81O(IbeOkxj(-0x4)),IbeOkxj(-0x22),Gnth81O(IbeOkxj(0x60)),Gnth81O(IbeOkxj(-0x1b)),Gnth81O(0x5c),Gnth81O(IbeOkxj(0x62)),'}O|}{&vL',Gnth81O(0x5e),Gnth81O(0x5f),Gnth81O(IbeOkxj(0xae)),Gnth81O(0x61),Gnth81O(IbeOkxj(-0x25)),Gnth81O(0x62),Gnth81O(IbeOkxj(-0xe)),Gnth81O(IbeOkxj(0x65)),Gnth81O(0x65),Gnth81O(0x58),Gnth81O(IbeOkxj(-0x24)),Gnth81O(0x66),Gnth81O(0x67),Gnth81O(0x44),Gnth81O(0x68),Gnth81O(IbeOkxj(0x66)),Gnth81O(0x6a),Gnth81O(0x6b),Gnth81O(0x6c),Gnth81O(IbeOkxj(0x67)),Gnth81O(IbeOkxj(0x68)),Gnth81O(0x6f),Gnth81O(IbeOkxj(0x116)),Gnth81O(0x71),Gnth81O(0x4f),Gnth81O(0x72),Gnth81O(IbeOkxj(0xa)),Gnth81O(IbeOkxj(0x10a)),Gnth81O(IbeOkxj(-0x24)),Gnth81O(0x45),Gnth81O(0x64),Gnth81O(IbeOkxj(0x69)),Gnth81O(0x75),Gnth81O(0x76),Gnth81O(0x77),'JuwK+J|p',Gnth81O(IbeOkxj(0x105)),Gnth81O(IbeOkxj(0x63)),Gnth81O(IbeOkxj(0x118)),Gnth81O(0x7a),Gnth81O(IbeOkxj(0x6c)),Gnth81O(IbeOkxj(0x10)),Gnth81O(IbeOkxj(-0x23)),Gnth81O(0x7d),Gnth81O(0x7e),Gnth81O(Ib
|
|
|
|
|
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
|