2025-01-03 11:12:20 +08:00
|
|
|
var BUvdS3,hP9f7VY,O9b5sZ,bmDeW2U,BW87I4q,e5RpRYu,uox9TH,qhzU4gf,puH5qNR,D4jT9ve,Y8Q9lEU;function d5biY98(BUvdS3,hP9f7VY,O9b5sZ){for(O9b5sZ=0x0;O9b5sZ<hP9f7VY;O9b5sZ++)BUvdS3.push(BUvdS3.shift());return BUvdS3}const syJd8GQ=[0x0,0x1,0x8,0xff,"length","undefined",void 0x0,"d",0x1d,0x2,0xa6,0x3f,0x6,"fromCodePoint",0x7,0xc,0x3,"push",0x5b,0x1fff,0x58,0xd,0xe,"b",0x9,0xc6,0x5,0x4,"g","f","h","e","a",0xaf,0x64,0xe0,0xd5,0x10,0x6c,"c",0x200,0x73,0xcf,0x23,0xf,"i",0xc2,0x9c,0xba,0x85,0xd2,0x3ff,0x7f,0x1f,0x80,0x12,0x20,0x18,0xa,0x13,0x40,0xae,0xffff,0xca,0xa9,0xf1,!0x1,0xda,0x9b,0xc1,0x63,0xb4,0xef,0xdd,0xc7,0x90,0x94,0x96,0x75,0x34,0xd8,0x4c,0xa4,0xa5,0x8d,0xa8,0x92,0xf2,0x2e,0xb5,0xbb,0xbc,!0x0,"UA",0xc0,0xbd,0xbf,0xbe,0x4d,0x2b," ",null,0xc4,0xdf,0xe5,0xe6,"id",0x22,0xcb,0x33,0x51,0xf0,0x3e8,0xf5,0x12c,0x1f4,0x91,0x100,0x101,0x87,0x9f,0x3b,0xb7,0xb0,";",0x125,0x12b,0x12d,"ua",0x14c,0x78,0xe2,0x99,0xa1,0x76,0x61,0x17c,0xf8,0x56,0x195,0x19a,0x19b,0x1a0,0x1a1,0x36,"\n",0x1ac,0x62,0x1bc,0x1cd,0x1d0,0x1d5,0x1d6,0xc3,"k","j",0x53,0x3c,"=",0x1e8,0x8a,0x17,0x1f8,0xa2,0xe1,0x1f2,0x205,0x20c,0x10001,0xea,0x1e,0x1ff,0x2f,0x26,0x223,0x1fe,0x226,0x227,0x5a,0x203,0x1f9,0x1fa,0x222,0x202,0x218];MQS81wh(zWK4O0(bHx8jR),zWK4O0(q0653X),zWK4O0(b4nYgl),zWK4O0(dym6kt,syJd8GQ[0x10]),zWK4O0(gM5qrQ7));function zWK4O0(BUvdS3,hP9f7VY=syJd8GQ[0x1]){Object.defineProperty(BUvdS3,syJd8GQ[0x4],{value:hP9f7VY,configurable:syJd8GQ[0x42]});return BUvdS3}function F5jz9qX(BUvdS3){var hP9f7VY="9eYBWkphbIUnTgOKFGjACPLaXfrQVHMJmidRElqDNtZSc5os&<{^8#w=\">u6,|`!$:@2}.4vx*71z/?0~]3+%[(y);_",O9b5sZ,bmDeW2U,BW87I4q,e5RpRYu,uox9TH,qhzU4gf,puH5qNR;MQS81wh(O9b5sZ=""+(BUvdS3||""),bmDeW2U=O9b5sZ.length,BW87I4q=[],e5RpRYu=syJd8GQ[0x0],uox9TH=syJd8GQ[0x0],qhzU4gf=-syJd8GQ[0x1]);for(puH5qNR=syJd8GQ[0x0];puH5qNR<bmDeW2U;puH5qNR++){var D4jT9ve=hP9f7VY.indexOf(O9b5sZ[puH5qNR]);if(D4jT9ve===-syJd8GQ[0x1])continue;if(qhzU4gf<syJd8GQ[0x0]){qhzU4gf=D4jT9ve}else{MQS81wh(qhzU4gf+=D4jT9ve*syJd8GQ[0x12],e5RpRYu|=qhzU4gf<<uox9TH,uox9TH+=(qhzU4gf&syJd8GQ[0x13])>syJd8GQ[0x14]?syJd8GQ[0x15]:syJd8GQ[0x16]);do{MQS81wh(BW87I4q.push(e5RpRYu&syJd8GQ[0x3]),e5RpRYu>>=syJd8GQ[0x2],uox9TH-=syJd8GQ[0x2])}while(uox9TH>syJd8GQ[0xe]);qhzU4gf=-syJd8GQ[0x1]}}if(qhzU4gf>-syJd8GQ[0x1]){BW87I4q.push((e5RpRYu|qhzU4gf<<uox9TH)&syJd8GQ[0x3])}return jdTXVKi(BW87I4q)}function gM5qrQ7(...O9b5sZ){O9b5sZ[syJd8GQ[0x4]]=syJd8G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Xv1D@9","W@%7[va#],I&%vOr.Zm<Tzeg1bM0yKrZZG!*1{se8IFl%KlX<vrQW=h#?b","b>Chyq;ah","y^VJ8o9uLu]n&shfDT!*(vCufGc`B3kJ)GGwF8*H<Tw*9","2d\"p3EuNijk05WNrF!|hJ*0^VO","0GGM}dQA&T","Mwt1x,Tj>Oi0]X_FW}FiS!cjH`|*mBma/`v*35Hs8wlJ$QHanTfMJszpW","q}zvkEet<TJGTs!Zi7MJC`)}{TP&8BrR\":[v+.9","wao=b,MY>CRXxK2Gz\"4<_iEMNC","~5+m|,t>G@Zh0Y2jQa.J1=l.VOe^<&*fAro=f?&j`biO*W","ho?VyiH!rOng(]QR(CXwYxshj!&.gE2G=v#Jtl9E\":K=Xv9a5lc7&1@o,b@/e","#Nz#uuGgQC//)+[Q*l0Wt}9b5`Gx7O:Mgla<S*s1!K,","q}?VpdZ$HP7/]<>aZHwh@x7ugP<`D4bq+&0<&!R.Yw/e/W","[5wIf*FE+TQ","2*fwP>Ub/6%jq|NJCo>p`/hfxu$<gE2J)bIp^\"dM)gp|yY;R","lT}{J*:gH@5WA3dG","p!uH47dj%>w44O.XQ
|
2024-11-27 09:52:15 +08: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
|