2024-12-09 15:54:00 +00:00
|
|
|
var iTGqsM,m2abHs5,I5yrhGN,pf9wvr,tGgdxf,xSF44k,QZ9_zZ,WN0KaM,UodoLTD;const Ud152bj=[0x0,0x1,0x8,0xff,"length","undefined",0x3f,0x6,"fromCodePoint",0x7,0xc,"push",0x5b,0x1fff,0x58,0xd,0xe,0x6a,0x6e,0x70,!0x1,0x7f,0x80,0x6b,0x84,0x87,0x88,0x8a,0x8b,0x91,0x92,0x9c,0x9d,0xa0,0xa7,0xac,0xae,0xb5,0xb6,0xba,0xbb,!0x0,0xbc,0xbe,0xc2,0xbf," ",0xd5,0xdf,0x7d0,0xef,0x3,0xf2,0xf0,0xec,0x10a,0x10b,0xed,0xf8,0x3e8,0xa,0x1f4,0x11b,0x125,0x126,0x12c,0x133,0x132,0xee,0x320,0x139,void 0x0,0x149,0x151,0x14c,0x15a,0x156,0x157,0x163,0xf9,0x159,0x102,0x95,0x17a,0x17b,0x17c,0x17d,0x177,0x176,0x18f,0x182,0x18b,0x1a1,0x1a2,0x1a5,0x1a9,0x1aa,0x1b9,0x1f,0x1ba,0x5,0x2,0x1b7,0x1cb,0x1cc,null,0x69,0x1d2,0x1d0,0x1e2,0x1dd,0x1eb,0x1ed,0x1ef,0x1ee,0x1f0,0x1f1,0x1f2,0x1ec,0x1f5,0x1f6,0x1f7,0x1f8,0x1ea,0x204,0x202,0x206,0x201,0x20b,0x20a,0x20e,0x3c,0x212,0x213,0x217,0x21d,0x21e,0x21f,0x220,0x221,0x222,0x223,0x224,0x225,0x226,0x22a,0x22b,0x22c,0x230,0x232,0x231,0x241,0x242,0x239,0x244,0x245,0x23d,0x23f,"0",0x247,0x23a,0x23c,0x1fc,0x1fd,0x1fe,0x23b,0x240,0x23e,0x24f,0x253,0x255,0x25c,0x25d,0x260,"\u3011",0xf,0x26b,0x263,0x264,0x265,0x267,0x268,0x269,0x26d,"\u4EAC\u8C46",0x27c,0x282,0x283,0x284,0x287,0x288,0x281,0x28d,0x289,0x27d,0x14,0x292,0x17,0x28b,"\u706B\u7206",0x2a0,";",0x2a7,0x2a9,0x29a,0x29c,0x29d,0x29e,0x29f,0x2a4,0x2a1,"UA",0x2ab,0x7530,0x2b3,0x2b8,0x2a2,"=",0x2b9,0x99,0x2c9,0x196,0x2cd,0x8e,0x2aa,0x2b2,0x2eb,0x1e0,0x1e5,0x2cb,0x2ef,0x2f0,0x2b7,"-v",0x2ce,0x2d3,0x2d4,0x2ff,"fn",0x2d7,0x2d9,0x2da,"cl","H5",0x2db,0x2dc,0x2dd,"ua",0x2de,0x2df,0x2e0,0x2e1,0x2e2,0x2e3,0x2e4,0x2e5,0x2e6,0x2e7,0x2e8,0x2e9,0x305,0x2ec,0x2ed,0x30a,0x30b,0x2be,0x2bf,0x30f,0x306,0x2c5,0x313];function XnnTapQ(iTGqsM){var m2abHs5="yu)=>50*|2&kbf<cWqQGHZKNFrDTjY6.]+sn/U!Cp:^@3#7O$E,89X[VwxIo(~\";veB_R4m{Jl1z`SgM}ihAP%datL?",I5yrhGN,pf9wvr,tGgdxf,xSF44k,QZ9_zZ,WN0KaM,UodoLTD;zRRD39(I5yrhGN=""+(iTGqsM||""),pf9wvr=I5yrhGN.length,tGgdxf=[],xSF44k=Ud152bj[0x0],QZ9_zZ=Ud152bj[0x0],WN0KaM=-Ud152bj[0x1]);for(UodoLTD=Ud152bj[0x0];UodoLTD<pf9wvr;UodoLTD++){var XnnTapQ=m2abHs5.indexOf(I5yrhGN[UodoLTD]);if(XnnTapQ===-Ud152bj[0x1])continue;if(WN0KaM<Ud152bj[0x0]){WN0KaM=XnnTapQ}else{zRRD39(WN0KaM+=XnnTapQ*Ud152bj[0xc],xSF44k|=WN0KaM<<QZ9_zZ,QZ9_zZ+=(WN0KaM&Ud152bj[0xd])>Ud152bj[0xe]?Ud152bj[0xf]:Ud152bj[0x10]);do{zRRD39(tGgdxf.push(xSF44k&Ud152bj[0x3]),xSF44k>>=Ud152bj[0x2],QZ9_zZ-=Ud152bj[0x2])}while(QZ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P8X&XSQ|e2t/.!~NsR!Ehxl*>GbIV<_rz<rTA4p7\";owIfRFo<alH","gk91x8x;;c1]zDSDrR20G!xu","n(+]P\"//8GA|\"i[jb7K>","N28Se$%N2qI","CH:[(mqr>xVma=>rB$AYGoBb5f3","`NA|FxgQ3XvZQ~&Hux`1g1s9Ax%]]A=r^\"49?!D1+;Fq<~0","5[IXZA#nMwAmTD$T!{09X;v0;X7B+WEs^pS,54<)","^xNld{H7foa1W/SG#x~`0([QKG","U=y2[CJ9?\"hmI<?jfE>1{V*:jqWH.<u.5noSG{gs&H8l$$ipaq4DS1y","[e~&}{b9nbkz+JCGMl0`l\"36u(}m%>","?=x8%A}pBb0hu","7bh|Vhef3q)~]Os6>1kYe(Zu)xO`}/?:$05*<",";oNl.9PFrI8BRcXp:UrgNO>^3|E\"ZW]U>2a2F!77g|Sup{;NzN*2","_UK9s~%uvx#qCD[pPsh|*4v77;9j3T+^nU;jQ/P9M(2eu","T1]09IoO&\"6J9$nq!0^zM\"j6q[]M|PhsA=nSfxquB2Rke/aK;\"I8IIVu","Xpp[g$v6
|
2024-12-09 15:08:34 +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
|