2024-11-16 12:13:00 +00:00
|
|
|
function OmxeV8L(){}var r09oR9=Object['defineProperty'],TeDF5jH,D0TGVVY,qm0Ggc,aFolRn,TEAJpu,z5leOd,npU0gI,neAikoZ,cTWqbWb,A0NYj1,ecbep2u,EZrkvI,jxecQ9O,y4r9yK,bkjygdw,U7FjWA,cuifZaQ,X3C5TcM;function t7IqFKC(OmxeV8L){return TeDF5jH[OmxeV8L>0x17d?OmxeV8L+0x1:OmxeV8L>0x17d?OmxeV8L+0x3:OmxeV8L<0x17d?OmxeV8L-0x5e:OmxeV8L-0x24]}TeDF5jH=eGI_Dz();function gtBLdo(OmxeV8L,r09oR9){return D0TGVVY(OmxeV8L,'length',{value:r09oR9,configurable:!0x0})}OmxeV8L(D0TGVVY=Object.defineProperty,qm0Ggc=bwokz0s((OmxeV8L,r09oR9)=>{return r09oR9(OmxeV8L())},0x2)(aJMjRa,az9C1P));var IoxPqs5=[],UxA2NvR=[gtZCJM(0x0),gtZCJM(t7IqFKC(0x7d)),gtZCJM(0x2),gtZCJM(0x3),gtZCJM(0x4),gtZCJM(t7IqFKC(0x96)),gtZCJM(t7IqFKC(0x82)),gtZCJM(t7IqFKC(0x83)),gtZCJM(0x8),gtZCJM(0x9),gtZCJM(t7IqFKC(0xd9)),gtZCJM(0xb),gtZCJM(0xc),gtZCJM(t7IqFKC(0xa8)),gtZCJM(0xe),gtZCJM(0xf),'f|4M',gtZCJM(t7IqFKC(0xa7)),gtZCJM(0x11),gtZCJM(t7IqFKC(0x84)),gtZCJM(0x13),gtZCJM(t7IqFKC(0xaa)),gtZCJM(t7IqFKC(0x71)),gtZCJM(0x16),gtZCJM(0x17),gtZCJM(t7IqFKC(0xac)),gtZCJM(0x19),gtZCJM(0x1a),gtZCJM(t7IqFKC(0x88)),gtZCJM(t7IqFKC(0x5e)),gtZCJM(0x1d),gtZCJM(t7IqFKC(0x5f)),gtZCJM(t7IqFKC(0xaf)),gtZCJM(0x20),gtZCJM(0x21),gtZCJM(t7IqFKC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M(0x4f),gtZCJM(0x4e),gtZCJM(0x50),'mNaOs5|n',gtZCJM(0x51),gtZCJM(0x52),gtZCJM(0x53),gtZCJM(t7IqFKC(0x8b)),'9r$H|Mf7',gtZCJM(0x48),'9r$H|Mf7',gtZCJM(t7IqFKC(0x114)),gtZCJM(t7IqFKC(0x79)),gtZCJM(0x55),gtZCJM(0x56),gtZCJM(0x57),gtZCJM(0x58),gtZCJM(0x59),gtZCJM(t7IqFKC(0x62)),gtZCJM(t7IqFKC(0x63)),gtZCJM(0x5c),gtZCJM(t7IqFKC(0x6c)),gtZCJM(t7IqFKC(0x64)),'G(q)oA;/B3*W.h|ZJa8ozAf',gtZCJM(0x5f),gtZCJM(0x60),gtZCJM(t7IqFKC(0x65)),gtZCJM(t7IqFKC(0x76)),gtZCJM(t7IqFKC(0xd5)),gtZCJM(0x64),gtZCJM(t7IqFKC(0x66)),gtZCJM(0x66),'GEl/hjQ||w',gtZCJM(t7IqFKC(0x68)),gtZCJM(0x67),gtZCJM(0x68),gtZCJM(0x69),gtZCJM(t7IqFKC(0x157)),gtZCJM(t7IqFKC(0x60)),gtZCJM(0x6b),gtZCJM(t7IqFKC(0x61)),gtZCJM(0x6c),gtZCJM(0x6d),gtZCJM(0x6e),gtZCJM(0x51),gtZCJM(t7IqFKC(0x6a)),gtZCJM(0x70),gtZCJM(0x71),gtZCJM(0x72),gtZCJM(t7IqFKC(0xe9)),gtZCJM(0x2a),gtZCJM(0x74),gtZCJM(0x75),gtZCJM(0x76),gtZCJM(0x77),gtZCJM(t7IqFKC(0xa6)),gtZCJM(0x78),gtZCJM(0x2a),gtZCJM(t7IqFKC(0x69)),gtZCJM(t7IqFKC(0x6b)),gtZCJM(t7IqFKC(0x62)),gtZCJM(t7IqFKC(0x63)),gtZCJM(0x7a),gtZCJM(0x5c),gtZCJM(0x7b),gtZCJM(t7IqFKC(0x64)),'7DGo=0H&>r)|=m>t"hV',gtZCJM(t7IqFKC(0x70)),gtZCJM(0x60),gtZCJM(t7IqFKC(0x65)),'`cY73`+L@w4<Lk|Z',gtZCJM(t7IqFKC(0x75)),gtZCJM(0x62),gtZCJM(t7IqFKC(0x66)),gtZCJM(0x66),t7IqFKC(0x67),gtZCJM(t7IqFKC(0x68)),gtZCJM(0x67),gtZCJM(t7IqFKC(0x60)),gtZCJM(t7IqFKC(0x6d)),gtZCJM(0x15),gtZCJM(t7IqFKC(0x61)),gtZCJM(t7IqFKC(0x78)),gtZCJM(0x6e),gtZCJM(0x7d),gtZCJM(0x7e),gtZCJM(0x6f),gtZCJM(0x7f),gtZCJM(t7IqFKC(0x61)),gtZCJM(t7IqFKC(0x69)),gtZCJM(0x79),gtZCJM(0x80),gtZCJM(t7IqFKC(0xf0)),gtZCJM(0x82),gtZCJM(t7IqFKC(0xec)),'*|VrM',gtZCJM(0x84),gtZCJM(t7IqFKC(0x7a)),gtZCJM(t7IqFKC(0xf3)),'@|<mo=3g*BN]Ctb','BK]mV$xBs"`[{0D|C"f#/EN!G"&v;Pb+F7D}hy[gL',gtZCJM(0x87),'@|Q6b$Oi',gtZCJM(0x88),gtZCJM(0x89),gtZCJM(0x7c),gtZCJM(t7IqFKC(0xf7)),gtZCJM(0x4c),gtZCJM
|
2024-11-03 15:57: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
|