2024-11-26 04:35:52 +00:00
|
|
|
function CFbygZx(){}var _lp89j1=Object['defineProperty'],YBWTBm,bQf6ORz,IVMFIVM,u3AgJw,BsRqcjf,zk8X4Q,Fry9OC4,thlm8Ak,aoDyY_G,vN2mWzv,VL5fdz,usHP6i,FabmWh,sPRunx,Zdgkwb,ijgZE4,E24AYwn;function wHDuyx(CFbygZx){return YBWTBm[CFbygZx>0xa?CFbygZx<0xa?CFbygZx-0x4:CFbygZx<0xa?CFbygZx+0x39:CFbygZx-0xb:CFbygZx-0x39]}YBWTBm=JFGLdrT();function k6Rc0s(CFbygZx,_lp89j1){bQf6ORz(CFbygZx,'length',{value:_lp89j1,configurable:!0x0});return CFbygZx}CFbygZx(bQf6ORz=Object.defineProperty,IVMFIVM=uHHOVL((CFbygZx,_lp89j1)=>{return _lp89j1(CFbygZx())},0x2)(i9ogB6t,RWbT_q));var Ax54_hM=[],FdcecrY=[n_cC1U(0x0),n_cC1U(wHDuyx(0x16)),n_cC1U(0x2),'c|bq9$L~',n_cC1U(0x3),n_cC1U(0x4),n_cC1U(0x5),n_cC1U(0x6),n_cC1U(wHDuyx(0x1e)),n_cC1U(wHDuyx(0x1d)),n_cC1U(0x9),n_cC1U(0xa),n_cC1U(0xb),n_cC1U(wHDuyx(0x14)),'GrJt7|,@wS!+NuG|=1V9Nlx5^q',n_cC1U(0xd),n_cC1U(wHDuyx(0x21)),n_cC1U(wHDuyx(0x13)),'Q{;n<:*#XbSIMHQ:i^vGMNR4+>k1c"u4^Mv)`VT(5h3>=e{5=^0~<C<F|6DaG`wfO~]Z9]XM<F+CE3,',n_cC1U(0x10),'KwBI|vV&]Z7',n_cC1U(0x11),n_cC1U(0x12),n_cC1U(wHDuyx(0x5f)),n_cC1U(0x14),n_cC1U(0x15),n_cC1U(wHDuyx(0xe)),n_cC1U(0x17),n_cC1U(0x18),n_cC1U(0x19),n_cC1U(0x1a),n_cC1U(0x1b),n_cC1U(0x1c),n_cC1U(0x1d),n_cC1U(0x1e),n_cC1U(wHDuyx(0x12)),n_cC1U(0x20),n_cC1U(wHDuyx(0x2b)),'!mA}Q2(F@Y,mxE=0""0/Lk1fch3IB}*i|yRwe2"#',n_cC1U(0x22),n_cC1U(0x23),n_cC1U(wHDuyx(0xc)),n_cC1U(0x25),n_cC1U(0x26),n_cC1U(0x16),'|{lME',n_cC1U(0x27),n_cC1U(0x28),n_cC1U(0x29),n_cC1U(0x2a),n_cC1U(0x2b),n_cC1U(0x2c),n_cC1U(0x2d),n_cC1U(0x2e),n_cC1U(0x2f),n_cC1U(0x30),n_cC1U(0x31),n_cC1U(0x32),n_cC1U(0x33),n_cC1U(0x34),n_cC1U(wHDuyx(0x60)),n_cC1U(0x36),n_cC1U(0x37),n_cC1U(0x38),n_cC1U(0x39),'l:|Z{SKe',n_cC1U(wHDuyx(0x59)),n_cC1U(0x3b),n_cC1U(0x3c),n_cC1U(0x3d),n_cC1U(0x3e),n_cC1U(0x3f),n_cC1U(0x40),n_cC1U(0x41),n_cC1U(0x42),n_cC1U(0x43),n_cC1U(0x44),n_cC1U(0x45),n_cC1U(0x46),n_cC1U(0x47),n_cC1U(0x48),n_cC1U(0x49),n_cC1U(0x4a),n_cC1U(0x4b),n_cC1U(0x4c),n_cC1U(0x4d),n_cC1U(0x4e),n_cC1U(0x4f),'|G>NTtrm',n_cC1U(0x50),n_cC1U(0x51),n_cC1U(0x52),'zJt~R}!Y^*h8|BiJ"",O',n_cC1U(0x53),n_cC1U(wHDuyx(0x2d)),n_cC1U(0x55),n_cC1U(wHDuyx(0x2e)),n_cC1U(wHDuyx(0x2f)),n_cC1U(wHDuyx(0x30)),n_cC1U(0x59),n_cC1U(0x5a),n_cC1U(0x5b),n_cC1U(0x5c),n_cC1U(0x5d),n_cC1U(0x5e),n_cC1U(0x5f),n_cC1U(0x60),n_cC1U(0x61),n_cC1U(0x62),n_cC1U(wHDuyx(0x33)),n_cC1U(0x64),n_cC1U(0x65),n_cC1U(0x66),n_cC1U(0x67),n_cC1U(0x68),n_cC1U(0x69),n_cC1U(0x6a),n_cC1U(0x6b),n_cC1U(0x6c),n_cC1U(wHDuyx(0x20)),n_cC1U(0x6e),n_cC1U(0x6f),n_cC1U(0x70),n_cC1U(0x71),n_cC1U(0x72),n_cC1U(0x73),n_cC1U(0x74),n_cC1U(wHDuyx(0x1f)),n_cC1U(0x76),n_cC1U(0x77),n_cC1U(0x78),n_cC1U(0x79),n_cC1U(0x7a),n_cC1U(0x7b),n_cC1U(0x7c),n_cC1U(0x7d),n_cC1U(0x7e),n_cC1U(0x7f),n_cC1U(0x80),n_cC1U(0x81),n_cC1U(wHDuyx(0x35)),n_cC1U(0x83),n_cC1U(0x84),n_cC1U(0x85),n_cC1U(0x86),n_cC1U(0x87),n_cC1U(0x88),n_cC1U(0x89),n_cC1U(0x8a),n_cC1U(0x8b),n_cC1U(0x8c),n_cC1U(0x8d),n_cC1U(0x8e),n_cC1U(0x8f),'Whnwjc*&Gvt|O,',n_cC1U(0x90),n_cC1U(0x91),'E^%I^CN&uFS|#',n_cC1U(0x92),n_cC1U(0x93),n_cC1U(0x94),n_cC1U(0x95),n_cC1U(0x96),n_cC1U(0x97),n_cC1U(0x98),n_cC1U(0x99),n_cC1U(0x9a),n_cC1U(0x9b),n_cC1U(0x9c),n_cC1U(0x9d),n_cC1U(0x9e),n_cC1U(0x9f),n_cC1U(0xa0),n_cC1U(wHDuyx(0x36)),n_cC1U(0xa2),n_cC1U(0xa3),n_cC1U(0xa4),'ga?O0x;TTvt|#d$2<NP',n_cC1U(0xa5),n_cC1U(0xa6),n_cC1U(0xa7),n_cC1U(0xa8),n_cC1U(0xa9),n_cC1U(0xaa),n_cC1U(0xab),n_cC1U(0xac),n_cC1U(0xad),n_cC1U(0xae),'2^%p=*TDiXby/c{.Ws>PbpYW#o|*C',n_cC1U(0xaf),n_cC1U(0xb0),n_cC1U(0xb1),n_cC1U(0xb2),n_cC1U(0xb3),n_cC1U(0xb4),n_cC1U(0xb5),n_cC1U(0xb6),n_cC1U(wHDuyx(0x38)),n_cC1U(0xb8),n_cC1U(0xb9),n_cC1U(0xba),n_cC1U(0xbb),n_cC1U(0xbc),';fD~5}@@Tvt|#d$2<NP',n_cC1U(0xbd),n_cC1U(0xbe),n_cC1U(0xbf),'pEoZwx|e',n_cC1U(0xc0),n_cC1U(0xc1),n_cC1U(0xc2),n_cC1U(0xc3),n_cC1U(0xc4),n_cC1U(0xc5),n_cC1U(0xc6),n_cC1U(0xc7),n_cC1U(0xc8),n_cC1U(0xc9),n_cC1U(0xca),n_cC1U(0xcb),n_cC1U(wHDuyx(0x3a)),n_cC1U(0xcd),n_cC1U(wHDuyx(0x3b)),n_cC1U(0xcf),n_cC1U(0xd0),n_cC1U(0xd1),n_cC1U(0xd2),n_cC1U(0xd3),n_cC1U(wHDuyx(0x3e)),n_cC1U(wHDuyx(0x40)),'.ZQn8]j!Xaav>ap&dDJ=,K|MU)o>_po.[g{gQ]*&U){%u2Uj5P1gh_O@W)1%Xaj&1PAE>k<&t>N>5ar58P+Eo](9~Z{vC2"=Lbx5%2[fj1{%QP$4DyB,D3)M:|Z=^3,Fi6k5xwc@+|%V/4qfxyq]{3)M:|Z=`4uFi6
|
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
|