|
|
|
|
function pohOSjQ(){}var hvRjAF=Object['defineProperty'],FubRUC,iB_ltJy,G11tfVF,FnYRfG,J0AeDm,Ym6G3X,vRwsUt,RXn3oY,Qcw9KK6,atb3fqT,n1FNzyu,WSw29V,FFrd0sS,j2nECmW,boLsxp,Ap8tMyr,v0gUlv,AIsJ6dH,ZBl9pt;function TSutFX(pohOSjQ){return FubRUC[pohOSjQ>0x11b?pohOSjQ-0x3f:pohOSjQ>0x1b?pohOSjQ<0x1b?pohOSjQ-0x7:pohOSjQ>0x11b?pohOSjQ-0x48:pohOSjQ-0x1c:pohOSjQ-0x48]}FubRUC=hmfTUw();function Mnhutr(pohOSjQ,hvRjAF){var G11tfVF=tfsuiE(pohOSjQ=>{return FubRUC[pohOSjQ>0x56?pohOSjQ-0x57:pohOSjQ-0x60]},0x1);return iB_ltJy.call(G11tfVF(0x8d),pohOSjQ,'length',{value:hvRjAF,configurable:!0x0})}pohOSjQ(iB_ltJy=Object.defineProperty,G11tfVF=Mnhutr(tfsuiE((...hvRjAF)=>{pohOSjQ(hvRjAF.length=0x2,hvRjAF.URAkLXn=hvRjAF[0x1]);return hvRjAF.URAkLXn(hvRjAF[TSutFX(0x3f)]())}),0x2)(Umx2ry,Sgh9zs));var Qqroxo=[],MVo8N_w=[AjoB0N(0x0),AjoB0N(TSutFX(0x3b)),'"PVS|:*di',AjoB0N(TSutFX(0x3a)),AjoB0N(0x3),AjoB0N(0x4),AjoB0N(TSutFX(0x3e)),AjoB0N(TSutFX(0x40)),AjoB0N(0x7),AjoB0N(0x8),AjoB0N(0x9),AjoB0N(0xa),AjoB0N(0xb),AjoB0N(0xa),AjoB0N(0xb),AjoB0N(0xc),AjoB0N(TSutFX(0x4c)),AjoB0N(TSutFX(0x50)),'|XQ2O8@UZO+',AjoB0N(0xf),'|XQ2O8siML}',AjoB0N(0x10),AjoB0N(TSutFX(0xf8)),AjoB0N(0x12),AjoB0N(0x13),AjoB0N(0x14),AjoB0N(0x15),AjoB0N(0x16),AjoB0N(0x17),AjoB0N(TSutFX(0x59)),AjoB0N(0x19),AjoB0N(0x1a),AjoB0N(0x1b),AjoB0N(0x1c),AjoB0N(0x1d),AjoB0N(TSutFX(0x76)),AjoB0N(0x1f),AjoB0N(0x20),AjoB0N(0x21),AjoB0N(0x1e),AjoB0N(0x12),AjoB0N(0x22),AjoB0N(0x23),AjoB0N(TSutFX(0x27)),AjoB0N(0x25),AjoB0N(0x26),'vG^&#J|_',AjoB0N(0x27),AjoB0N(0x28),AjoB0N(0x29),'GPi;z3f*=|ZOLKN.R5KU5&KV.gZ{jD',AjoB0N(0x2a),AjoB0N(0x2b),AjoB0N(0x2c),AjoB0N(TSutFX(0x43)),AjoB0N(0x2e),AjoB0N(TSutFX(0xf2)),AjoB0N(0x26),AjoB0N(0x30),AjoB0N(0x27),AjoB0N(0x31),AjoB0N(0x32),AjoB0N(0x33),AjoB0N(0x34),'lwGfnho_9E^tM|#',AjoB0N(0x35),AjoB0N(0x36),AjoB0N(0x37),AjoB0N(0x38),AjoB0N(TSutFX(0x1c)),AjoB0N(0x3a),AjoB0N(0x3b),AjoB0N(0x3c),AjoB0N(0x3d),AjoB0N(TSutFX(0x29)),AjoB0N(0x3f),AjoB0N(0x40),AjoB0N(TSutFX(0xc9)),AjoB0N(0x42),AjoB0N(0x43),AjoB0N(0x44),AjoB0N(0x45),AjoB0N(0x46),AjoB0N(0x3a),'@s|bG',AjoB0N(0x47),AjoB0N(TSutFX(0x68)),AjoB0N(0x49),AjoB0N(0x4a),AjoB0N(0x4b),AjoB0N(TSutFX(0xfe)),AjoB0N(0x4c),AjoB0N(0x3c),AjoB0N(0x39),AjoB0N(TSutFX(0xa2)),AjoB0N(0x4d),AjoB0N(0x4e),AjoB0N(0x4f),AjoB0N(0x50),AjoB0N(0x51),AjoB0N(0x52),AjoB0N(0x53),AjoB0N(0x54),AjoB0N(0x55),'c<%jb5k|aMN$vTd}1>M)S"5bp44$Z',AjoB0N(0x56),AjoB0N(0x57),AjoB0N(0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joB0N(0x72),AjoB0N(0x73),AjoB0N(0x74),AjoB0N(TSutFX(0x6e)),AjoB0N(0x76),AjoB0N(0x77),AjoB0N(0x78),AjoB0N(0x79),AjoB0N(0x7a),AjoB0N(0x7b),'@BmcW#%|"|01:/6K{>}S|r6fq"Pu7',AjoB0N(0x7c),AjoB0N(0x7d),AjoB0N(0x7e),AjoB0N(0x7f),AjoB0N(TSutFX(0x45)),AjoB0N(0x27),AjoB0N(0x28),'@>t|p',AjoB0N(0x80),AjoB0N(TSutFX(0x82)),AjoB0N(0x82),AjoB0N(0x83),AjoB0N(0x84),AjoB0N(0x85),'1oU|}=lx6*S',AjoB0N(0x86),AjoB0N(0x87),AjoB0N(0x88),AjoB0N(0x89),AjoB0N(0x8a),'(C2*R|jdeC,','n~t|01Q@',AjoB0N(0x8b),'"LSficr/J?|).T1',AjoB0N(TSutFX(0x61)),AjoB0N(0x8d),'8a8gEhC,Zlr7@JTmdJQ|yqAIy,Gm7~3lU">55LKn=zQ)l_tk$w;%w+oV[Tv"y0BM8v/y4BC#@:vS{HH{wr!QMlQX"|Ew=KJR@x[5%x0=A"
|
2024-11-26 13:31:12 +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
|