2024-12-11 01:29:33 +00:00
|
|
|
|
var yzQlTF,rFYBo7,Uh1E6Ac,UGnU_9n,k5lQNA,aNIce2D,UoQwbS5,rh2D1y,y_aX62g,YxYwTj,NfHEAn;const Bwidm8=[0x0,0x1,0x8,0xff,"length","undefined",0x3f,0x6,"fromCodePoint",0x7,0xc,"push",0x5b,0x1fff,0x58,0xd,0xe,0x7f,0x80,!0x1,0x8e,0x8f,0x2,0x3,0x91,0x93,!0x0,0x97,0x9a,0xa0,0x9e,0x2000000,0x4000000,0xb8,0xba,0x10,0x200,0x4,0xf,0x3ff,0xc0,0x1f,0x12,0x20,0x5,0x18,0xa,0x13,0x40,0xffff,0xdc,0xdd,0xdf,0xe0,0xde,0xdb,0xef,0xf0," ",0xf7,"UA",0xfb,0xe4,0x100,0x112,0x119,null,"\u3011",0x121,0x123,0x124,0x125,0x122,0x126,0x127,0x11a,0x13b,0x11b,0x14f,0x13c,0x15b,0x163,"\n",0x160,0x161,0x116,0x117,0x16a,"\u7EA7]",0x16e,0x175,0x176,0x173,0x174,0x16c,0x16d,0x118,0x180,0x181,0x182,0x183,0x17e,0x1f4,0x193,0x194,0x17a,0x17b,"%",0x1ab,0x1af,0x3e8,0x1ac,void 0x0,0x1d4,0x1d3,0x1e1,0x1e7,0x1ec,0x1e9,0x1a5,0x201,"\u6B21",0x206,0x20b,0x20c,0x20d,0xd800,0xdbff,0xdc00,0x10000,0xdfff,0x215,0x216,0xf8,0x208,0x209,0x22e,0x230,0x231,0x203,0x1a8,0x23c,0x23f,0x244,0x64,0x248,0x249,0x24c,0x24d,0x245,0x25b,"\u6D47\u6C34",0x25d,0x25e,"g\uFF0C",0x262,0x275,0x277,0x278,0x279,0x276,0x287,0x28c,0x28d,0x290,0x293,0x295,0x29a,0x297,0x29d,0x29e,0x291,0x28e,0x28f,0x2a3,0x2a4,0x2a9,0x2aa,"/","0",0x2ae,":",0x288,0x2bc,0x2bd,0x2b8,0x2c0,0x2c2,0x2be,0x2cb,0x2cc,",","-",0x2d2,"\u3010",0x2db,0x2dc,0x2df,0x3c,0x2e5,0x2e6,0x9d,0xa6,0x2e8,0x2e9,"1",0xa7,0x2ed,0xc8,0xa3,0x2f9,0x2fa,0x2fb,0x2fd,0x2fe,0x300,0x301,0x302,0xa4,0xa8,0xaa,0x30a,0x30b,0x9f,0xa1,0x30d,0x30e,0x311,0x1a7,0x2f3,0x2f4,0x2f5,0xb2,0x315,0x320,0x31d,0x318,0x31a,0x1f8,0x314,0x327,0x31e,0x310,0x322,0x23e,0x32f,0x337,0x339,0x349,";",0x351,0x32d,0x90,0x348,0x5dc,0x34b,0x34c,"fn",0x34d,0x34e,0x353,0x354,"ua",0x355,0x35d,0x35f,0x361,0x8c,"2",0x30f,0xa2,0x363,0x364,0x352,0x35c,"fg",0x356,0x357,0x358,0x359,0x35b,0x6e,0x365,0x340,0x342,0x343,0x346,0x347,0x7530,0x37a,0x37b,0x37c,0x37d,0x37e,0x37f,0x380,0x381,0x384,0x345,0x388,0x389,0x23d,0x38b,0x382,0x383,0x39d,0x395,0x396,0x2710,0x32e];function TyJ__r2(yzQlTF){var rFYBo7="\"eAkOWsoQhTHRLXBcaCpbVIrMDtEnGiUPZFJjYgqmfNK4z`lS_0d*]>&$@7:,#;y?}3x=9^)+![w<~v{/%.518u(|26",Uh1E6Ac,UGnU_9n,k5lQNA,aNIce2D,UoQwbS5,rh2D1y,y_aX62g;gOD1fLg(Uh1E6Ac=""+(yzQlTF||""),UGnU_9n=Uh1E6Ac.length,k5lQNA=[],aNIce2D=Bwidm8[0x0],UoQwbS5=Bwidm8[0x0],rh2D1y=-Bwidm8[0x1]);for(y_aX62g=Bwidm8[0x0];y_aX62g<UGnU_9n;y_aX62g++){var YxYwTj=rFYBo7.indexOf(Uh1E6Ac[y_aX62g]);if(YxYwTj===-Bwidm8[0x1])continue;if(rh2D1y<Bwidm8[0x0]){rh2D1y=YxYwTj}else{gOD1fLg(rh2D1y+=YxYwTj*Bwidm8[0xc],aNIce2D|=rh2D1y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72%)XKgL_QshSnA","`@5]y~?`d,:","kR>nN!>[!a","M>PslYQ7=hE&T#=UhC*~,{ZJ*?T.}S|J+$o<4wIA0p","4;avz#H]:}uxacab/H=t+,/M[aXirX$FAKes","};(_P/?i!a","tBb~o%lw4$n{T#qD2SOGQ<7ME;=VFW",";SNd%Z8@G:V<+:)pd@RGEv/*4XVUblYULKO[c)bMvHosBA!p&ks*=&~@ah0","9zOWK^jjCR([cSopkJIOnveD.>AYzST","rstPh%iik","FBn~%%YovB[JIW|FKd(_jwuFFB:_{g%Esrgns[kfy$KM@OPGuF\"i7]4`W","e_^O\"{?7=@]yHAXb","AG4~#1roPy,PDO@nr,*&b0nC`H)^L#}r6$V&^j+R_C","&@M>\"1woNX!`q^~qJG<WR[pLBCJV[%]nhO2>zYvm>LHY5^CniFk","+X0QL0Bl%@&<4kjUkhq!#+I[WLl<kE9Mg}HTq_Yl3yY","8NMvD<X`\"R4SL+qC*tP
|
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
|