2024-12-10 14:48:10 +00:00
|
|
|
|
var ozq_YX,n_78F2,NdWXvz,hj6L10A,ioKQgy7,Dwwhxf,uZn4MQ,dlp1Eh,dX4hsy,jjqbUI,iUajeG;const eRzLqYa=[0x0,0x1,0x8,0xff,"length","undefined",0x3f,0x6,"fromCodePoint",0x7,0xc,"push",0x5b,0x1fff,0x58,0xd,0xe,0x64,!0x1,0x76,0x77,0x3,0x79,0x7b,!0x0,0x7f,0x80,0x82,0x81,0x86,0x84,0x9d,0x9f,0xbe,0xbf,0xc0,0xc2,0xbd,0xc1," ",0xd9,0xdd,0xc6,0xdf,"UA",0xef,0xf5,0xf7,0xfb,0x5,"\u3011",0x104,0x105,0x10c,0x106,0x107,0x117,0x11e,0xfc,0x121,0x118,0x130,0x3ff,0x10000,0xa,0xd800,0xdc00,0x1f,0xf,0xe0,0x12,0xf0,0xf8,0x14c,0x150,"\n",0x15a,0x15b,0x15c,"\u7EA7]",0x160,0x167,0x168,0x165,0x166,0x15e,0x15f,0x16f,0x172,0x173,0x174,0x1f4,0x182,0x183,0x16c,0x16d,0x16e,"%",0xf2,0xf3,0x199,0x2,0x1a4,0x3e8,0x19a,0x19b,0x2000000,0x4000000,0x100,0x1c3,0x1c1,0x1d0,0x1d6,0x1db,0x1d8,0x193,0x195,0x196,0x1e9,0x78,"\u6B21",0x1fc,0x1fd,0x1fe,0x1f8,0x1f9,0x4,0x1f6,0x218,0x21a,0x21b,0x1f2,0x1f1,0x224,0x227,0x22c,0x230,0x22a,0x228,0x22d,null,"\u6D47\u6C34",0x240,0x241,"g\uFF0C",0x24c,0x24d,0x248,0x236,0x229,0x259,0x25b,0x25c,0x25d,0x25a,0x25e,0x267,0x1eb,0x269,0x26d,0x268,0x26f,0x272,0x1ea,0x274,0x275,0x26b,0x26a,0x27b,"/","0",0x281,":",0x28e,0x28f,0x291,0x27a,0x299,0x27c,",",0x27e,0x27f,0x280,"-",0x282,0x283,0x284,"\u3010",0x28b,0x29e,0x2a1,0x2a4,0x83,0x8c,0x2a6,0x2a7,"1",0x8d,0x2ab,0xc8,0x89,0x2b7,0x2b8,0x2b9,0x2bb,0x2bc,0x2be,0x2bf,0x2c0,0x8a,0x8e,0x90,0x2c5,0x2c6,0x85,0x87,0x2c8,0x2c9,0x2cc,0x2b1,0x2b2,0x2b3,0x98,0x273,0x2d0,0x1ec,0x2d7,0x2d6,0x2d3,0x2cf,0x2df,0x2cb,0x2da,0x226,0x2e6,0x26c,void 0x0,0x2ec,0x2ef,0x63,0x1ed,0x301,";",0x309,0x2e4,0x300,0x5dc,0x303,0x304,"fn",0x305,0x306,0x30b,0x30c,"ua",0x30d,0x315,0x317,0x319,0x74,"2",0x2ca,0x88,0x31b,0x31c,0x30a,0x314,"fg",0x30e,0x30f,0x310,0x311,0x313,0x2fc,0x2fa,0x2fd,0x2f7,0x2f9,0x2fe,0x31d,0x32a,0x32b,0x32c,0x32d,0x330,0x7530,0x33c,0x33d,0x33e,0x33f,0x32e,0x32f,0x225,0x347,0x340,0x341,0x331,0x335,0x336,0x352,0x34d,0x34e,0x2710];function pGtXIXA(ozq_YX){var n_78F2="t4[>9u$<\"?)Lv,Kc8w@|h3;ON0C6dAFJV%{:/H!1MU+`*qGIWTxj&bSp5~rflyZ^g=Dk7PR]#_YoBaQ.z}Xie(msEn2",NdWXvz,hj6L10A,ioKQgy7,Dwwhxf,uZn4MQ,dlp1Eh,dX4hsy;efC_JH(NdWXvz=""+(ozq_YX||""),hj6L10A=NdWXvz.length,ioKQgy7=[],Dwwhxf=eRzLqYa[0x0],uZn4MQ=eRzLqYa[0x0],dlp1Eh=-eRzLqYa[0x1]);for(dX4hsy=eRzLqYa[0x0];dX4hsy<hj6L10A;dX4hsy++){var jjqbUI=n_78F2.indexOf(NdWXvz[dX4hsy]);if(jjqbUI===-eRzLqYa[0x1])continue;if(dlp1Eh<eRzLqYa[0x0]){dlp1Eh=jjqbUI}else{efC_JH(dlp1Eh+=jjqbUI*eRzLqYa[0xc],Dwwhxf|=dlp1Eh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]{<Pc3m}n/<!6hRB=}.<t^QGz6|hQt","g{R<dQLUD?y9efxMXJ7CniEN.lz}GTZFA])V:M}Ui~,wI!/J5Kmd2%F&Q@",";vwj3P[m=c&:4","n=7JVIvN`5&_1i,1e>O_{:RvV?hB&lgF]q[","OGvAt.M@Ehi^_W}M\"]jV(xpOZ@;r09kw6H[","3jQ_M:}U8c+37>z{O=K<JyDGi~V","o$@VdfN&\"h2;)yj{mRla8~]U{|Rc{u!H$^V6exRv8~RTT8%+5S>","if(de!W@\",","J`iV$p+&x^_Gv1uN1]E_;B?U%@t]o>Sd9OH<X%|Az@!",";7SJSHQ&>SY986G|j>WSu/h/4^OZ3#!0~]J?ZrjIz^V#uH/!eq*YePI:>","#Wmd>{JAYZ2kC[idg_;Ju#k4","2{QJ)P\"GAZWd1Cwh?~S&fj+rt3G<\"1W1~Kp9$W>|%cpBt","Yh)#`RrMfKo@?/MJnjT\"^{K/$)!WT9Z/`wk\"tY[@g~iuzc[HK$)j8","OMaJJSO:vf&@iC#!9VZdT5WztDi\"<x1JxjC6Wo]A7SgT4","3VUjKY#Ytl~fC
|
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
|