2024-06-29 13:25:02 +00:00
|
|
|
const bdy_0x451517=bdy_0x4265;(function(_0x5a49c5,_0x5b1b91){const bdy_0x1a8623={_0x29b43c:'0x2bb',_0x6272a5:'0x149',_0xd7aa61:'bGkw',_0x1d0b6b:'0x1fc',_0x3a6ace:'0x1b9',_0x4b1353:'W$My'},_0x32bd07=bdy_0x4265,_0x2e2618=_0x5a49c5();while(!![]){try{const _0x362cdf=parseInt(_0x32bd07(bdy_0x1a8623._0x29b43c,'xzA@'))/(0xdfd+0x1e41*-0x1+0x31*0x55)+-parseInt(_0x32bd07('0x209','K468'))/(0x20e9+0x140d+0x1a7a*-0x2)*(parseInt(_0x32bd07('0x1bf','(JqD'))/(0x1cb4+-0x1b0f+0x26*-0xb))+parseInt(_0x32bd07('0x305','9vN@'))/(0x1*0xf25+-0x13*0x47+-0x9dc*0x1)*(parseInt(_0x32bd07(bdy_0x1a8623._0x6272a5,bdy_0x1a8623._0xd7aa61))/(-0x17*0xae+-0x9b+0x1042))+parseInt(_0x32bd07('0x174','M*V9'))/(0x1*0x469+0x1*-0x125f+0xb3*0x14)+-parseInt(_0x32bd07('0x231','kiGR'))/(-0x1*0x6d3+-0x2166+0x70*0x5c)*(parseInt(_0x32bd07(bdy_0x1a8623._0x1d0b6b,'Pxo1'))/(-0x1a0+-0x15c8+0x1770))+parseInt(_0x32bd07(bdy_0x1a8623._0x3a6ace,bdy_0x1a8623._0x4b1353))/(0x16ca*0x1+-0x1743+0xd*0xa)*(parseInt(_0x32bd07('0x268','W$My'))/(-0xbe3+-0x240*-0x5+0xad))+parseInt(_0x32bd07('0x175','I$&D'))/(-0xef2*-0x1+-0x137*0xd+-0x6*-0x26);if(_0x362cdf===_0x5b1b91)break;else _0x2e2618['push'](_0x2e2618['shift']());}catch(_0x347e9d){_0x2e2618['push'](_0x2e2618['shift']());}}}(bdy_0x405d,-0xbccdb*0x1+-0x17f28+-0x51*-0x4e3d));const bdy_0x45c3de=(function(){const bdy_0x5cbb1c={_0x4ad38b:'0x15a',_0xc9e960:'IJ)u',_0x3d3f5c:'W#Vk',_0x337b70:'6yV6',_0x927a52:'0x294',_0xc11e87:')E@J'},bdy_0x61d10e={_0x5dbabd:'hYL*',_0x9d6dc7:'0x12b',_0x419709:'Pxo1',_0x74ee35:'0x114',_0x50fba9:'8F6m'};let _0x3c028b=!![];return function(_0x3b3d0a,_0x5c1305){const _0x5cf28e=bdy_0x4265,_0x4e611d={};_0x4e611d[_0x5cf28e('0x19d','ty6g')]=_0x5cf28e('0x265','I$&D');const _0x3475a8=_0x4e611d;if(_0x5cf28e(bdy_0x5cbb1c._0x4ad38b,'xzA@')!==_0x5cf28e('0x167',bdy_0x5cbb1c._0xc9e960))return _0x32f4f2[_0x5cf28e('0x25e',bdy_0x5cbb1c._0x3d3f5c)](_0x25f8a7),_0xb9123[_0x5cf28e('0x20a',bdy_0x5cbb1c._0x337b70)](_0x349129[_0x5cf28e('0x197','kiGR')],'',_0x5cf28e(bdy_0x5cbb1c._0x927a52,bdy_0x5cbb1c._0xc11e87)),[];else{const _0x4f9c90=_0x3c028b?function(){const _0x66c8b9=bdy_0x4265;if(_0x3475a8[_0x66c8b9('0x1f4','BltF')]!==_0x66c8b9('0x14e',bdy_0x61d10e._0x5dbabd))_0x5e878d[_0x66c8b9(bdy_0x61d10e._0x9d6dc7,bdy_0x61d10e._0x419709)](_0x1b0d41[_0xb39018]);else{if(_0x5c1305){const _0x9ff2ba=_0x5c1305[_0x66c8b9(bdy_0x61d10e._0x74ee35,bdy_0x61d10e._0x50fba9)](_0x3b3d0a,arguments);return _0x5c1305=null,_0x9ff2ba;}}}:function(){};return _0x3c028b=![],_0x4f9c90;}};}()),bdy_0x5e6781=bdy_0x45c3de(this,function(){const bdy_0x4c7630={_0x11865b:'s(9&',_0x55ddf0:'8F6m',_0x4377b1:'0x226',_0x5888ed:')BCo',_0x3ca17b:'0x2f0',_0x413712:'kiGR',_0x5dbea6:'ekgu'},_0x328a9e=bdy_0x4265;return bdy_0x5e6781[_0x328a9e('0x116',bdy_0x4c7630._0x11865b)]()[_0x328a9e('0x1e0',bdy_0x4c7630._0x55ddf0)](_0x328a9e(bdy_0x4c7630._0x4377b1,'rw]]'))[_0x328a9e('0x2f1','kiGR')]()[_0x328a9e('0x11d',bdy_0x4c7630._0x5888ed)](bdy_0x5e6781)[_0x328a9e(bdy_0x4c7630._0x3ca17b,bdy_0x4c7630._0x413712)](_0x328a9e('0x1b7',bdy_0x4c7630._0x5dbea6));});bdy_0x5e6781();const bdy_0x599300=(function(){const bdy_0x1ed9d7={_0xfc9d3:')BCo',_0x22c7d8:'0x257',_0x363957:'0x144',_0xaccf5a:'0x2eb',_0x3ccb18:'0x16e',_0x32c941:'kiGR',_0x4c6227:'0x2a2',_0x55c1e0:'[APz',_0x17a296:'0x163',_0x1b0d7b:'ViXD'};let _0x48a2a1=!![];return function(_0x38cc4a,_0x7926b6){const _0xa325e4=_0x48a2a1?function(){const _0x51f411=bdy_0x4265;if(_0x51f411('0x1ed','xzA@')!==_0x51f411('0x1ac',bdy_0x1ed9d7._0xfc9d3))_0x24f925&&(_0x12bcf1=_0x1182f3[_0x51f411('0x2cd','rw]]')](_0x43767a),_0x7acd76[_0x51f411('0x273','4Zp#')][_0x51f411(bdy_0x1ed9d7._0x22c7d8,'xzA@')]==0x13c7*0x1+-0x488+-0x1*0xf3f?_0x1abb3e[_0x51f411(bdy_0x1ed9d7._0x363957,'BltF')](_0x3a4db1[_0x51f411('0x260','6uk5')][_0x51f411(bdy_0x1ed9d7._0xaccf5a,'DOLg')]):_0x240980[_0x51f411(bdy_0x1ed9d7._0x3ccb18,bdy_0x1ed9d7._0x32c941)](_0x17d60e[_0x51f411('0x2ec','0#hA')][_0x51f411(bdy_0x1ed9d7._0x4c6227,bdy_0x1ed9d7._0x55c1e0)]));else{if(_0x7926b6){const _0x26b73a=_0x7926b6[_0x51f411(bdy_0x1ed9d7._0x17a296,bdy_0x1ed9d7._0x1b0d7b)](_0x38cc4a,arguments);return _0x7926b6=null,_0x26b73a;}
|
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
|