2024-10-30 12:25:23 +00:00
|
|
|
|
function QasEKO(){}var ik2YSZp=Object['defineProperty'],tXJLiV,yOamy4,cxdHioa,cAM2bc,iASHvwb,Uxg8Ax,z2Unwch,qzVS3Wt,j0GfGn,s6fgXn,LeyjEo,Exz1ebJ,xVRk0ER,WAyPblh,zckYnw6,gE9L_4,axfuYS,wbf_zh6,R26vVaF,t3J6cw,acpwzuK,jSyh80d,Yf1I1h,qt3oBp;function PGhlrgj(QasEKO){return tXJLiV[QasEKO>0x35c?QasEKO-0x25:QasEKO-0x50]}tXJLiV=GXY3rw();function e_x8Ook(QasEKO,ik2YSZp){return yOamy4(QasEKO,'length',{value:ik2YSZp,configurable:!0x0})}QasEKO(yOamy4=Object.defineProperty,cxdHioa=iDcw4GC((QasEKO,ik2YSZp)=>{return ik2YSZp(QasEKO())},0x2)(Wy5UXzi,hkmVFV));var yabK39=[],cZyyHfu=[oLgsaxA(0x0),oLgsaxA(PGhlrgj(0x98)),oLgsaxA(0x2),oLgsaxA(0x3),oLgsaxA(0x4),oLgsaxA(PGhlrgj(0xaa)),oLgsaxA(PGhlrgj(0xa2)),oLgsaxA(0x7),oLgsaxA(0x8),oLgsaxA(PGhlrgj(0xbb)),oLgsaxA(0xa),oLgsaxA(0xb),oLgsaxA(PGhlrgj(0xa1)),oLgsaxA(0xd),oLgsaxA(0xe),oLgsaxA(PGhlrgj(0xa0)),oLgsaxA(0x10),oLgsaxA(PGhlrgj(0xcd)),oLgsaxA(PGhlrgj(0xa8)),oLgsaxA(0x13),oLgsaxA(0x14),oLgsaxA(PGhlrgj(0x50)),oLgsaxA(PGhlrgj(0xce)),oLgsaxA(0x17),oLgsaxA(0x18),oLgsaxA(0x19),'Vr&{YbnUje^xmy~6,{N<=MtQAQp8EkH(DZMWi{9gR.]<T}SrBT_]0.<V5!|dgHZy3f',oLgsaxA(0x13),oLgsaxA(0x15),oLgsaxA(PGhlrgj(0x5c)),oLgsaxA(PGhlrgj(0x1bb)),oLgsaxA(0x17),o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d),oLgsaxA(PGhlrgj(0xf0)),oLgsaxA(0x5f),oLgsaxA(PGhlrgj(0x54)),oLgsaxA(0x19),oLgsaxA(0x7f),oLgsaxA(PGhlrgj(0x95)),oLgsaxA(0x81),oLgsaxA(PGhlrgj(0x57)),oLgsaxA(0x82),oLgsaxA(PGhlrgj(0x16e)),'t?|=C1/<FVr',oLgsaxA(PGhlrgj(0x16f)),oLgsaxA(PGhlrgj(0x205)),oLgsaxA(0x86),oLgsaxA(0x60),'X:IMLCWP]<R+cJ|(_>R[44vz7>N?T?:$hf',oLgsaxA(PGhlrgj(0xf8)),oLgsaxA(PGhlrgj(0x5a)),oLgsaxA(PGhlrgj(0x226)),oLgsaxA(0x8a),oLgsaxA(0x8b),oLgsaxA(PGhlrgj(0x348)),oLgsaxA(PGhlrgj(0xf9)),oLgsaxA(0x8e),oLgsaxA(0x8f),oLgsaxA(PGhlrgj(0xfb)),oLgsaxA(PGhlrgj(0xfc)),oLgsaxA(PGhlrgj(0x58)),oLgsaxA(PGhlrgj(0x103)),oLgsaxA(0x94),oLgsaxA(PGhlrgj(0x104)),oLgsaxA(0x96),oLgsaxA(PGhlrgj(0x63)),oLgsaxA(0x98),oLgsaxA(PGhlrgj(0x102))
|
2024-10-14 05:28:14 +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
|