2024-11-08 14:11:07 +00:00
|
|
|
|
function h66Ise4(){}var RpmWkH=Object['defineProperty'],ozP8htD,IYLj5hc,mnJSXf,mMxo_O,jRRfC0,mEnrIC,pFbA93K,uLT9g5w,U_hCJk,W7Ja6p,NjvSAyq,hsajHZ,Dkvxa5,GqmbFPO,gi7TQG,MyE5Tx,mg5YUF,ZETK4h,pHw9jB,WstTWZ,Y9NZno,cw7NF8s;function gl0WFcP(h66Ise4){return ozP8htD[h66Ise4<0x1b2?h66Ise4>-0x33?h66Ise4>0x1b2?h66Ise4+0x51:h66Ise4>0x1b2?h66Ise4-0x51:h66Ise4+0x32:h66Ise4-0xb:h66Ise4+0x2e]}ozP8htD=uzSoaU();function B97pM6(h66Ise4,RpmWkH){return IYLj5hc.call(gl0WFcP(0x54),h66Ise4,'length',{value:RpmWkH,configurable:!0x0})}h66Ise4(IYLj5hc=Object.defineProperty,mnJSXf=B97pM6(FkhkJ1((...RpmWkH)=>{var IYLj5hc=FkhkJ1(RpmWkH=>{return ozP8htD[RpmWkH>0x62?RpmWkH-0x63:RpmWkH+0x26]},0x1);h66Ise4(RpmWkH[IYLj5hc(0xba)]=gl0WFcP(0x39),RpmWkH[gl0WFcP(-0x32)]=-0x4);if(RpmWkH.ij2GSD>gl0WFcP(0xa3)){return RpmWkH[-0x7e]}else{var mnJSXf=FkhkJ1(RpmWkH=>{return ozP8htD[RpmWkH>0x219?RpmWkH-0x3e:RpmWkH>0x34?RpmWkH-0x35:RpmWkH+0x40]},0x1);return RpmWkH[RpmWkH[gl0WFcP(-0x32)]+(RpmWkH[mnJSXf(0x35)]+mnJSXf(0xa1))](RpmWkH[0x0]())}}),0x2)(vu5CmA6,z7FBMBN));var hi7Z1V=[],NUVVeT=[_LbTW0S(0x0),_LbTW0S(gl0WFcP(0x28)),_LbTW0S(0x2),_LbTW0S(0x3),_LbTW0S(gl0WFcP(0x27)),_LbTW0S(gl0WFcP(0x26)),_LbTW0S(0x6),_LbTW0S(0x7),_LbTW0S(gl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W0S(0x64),_LbTW0S(gl0WFcP(0x93)),_LbTW0S(gl0WFcP(0x9c)),_LbTW0S(gl0WFcP(0x9d)),_LbTW0S(gl0WFcP(-0x1c)),_LbTW0S(gl0WFcP(-0x20)),_LbTW0S(0x6a),_LbTW0S(0x6b),_LbTW0S(0x6c),_LbTW0S(0x6d),_LbTW0S(0x4e),_LbTW0S(gl0WFcP(0x5b)),_LbTW0S(0x6f),'~T:1]L*|{`=xS',_LbTW0S(0x70),_LbTW0S(0x3f),_LbTW0S(gl0WFcP(0x7d)),_LbTW0S(0x72),_LbTW0S(0x73),_LbTW0S(gl0WFcP(-0x28)),_LbTW0S(gl0WFcP(-0x2f)),_LbTW0S(0x75),_LbTW0S(gl0WFcP(0x78)),_LbTW0S(gl0WFcP(0x8d)),'8aXpi07~(5wJwMn^|S','8aXpCZdq&5!cgM0q|S',_LbTW0S(gl0WFcP(0xa2)),_LbTW0S(0x79),_LbTW0S(gl0WFcP(-0x29)),_LbTW0S(0x7a),_LbTW0S(0x72),_LbTW0S(0x75),_LbTW0S(0x7b),_LbTW0S(gl0WFcP(-0x2e)),_LbTW0S(gl0WFcP(-0x1e)),_LbTW0S(g
|
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
|