|
|
|
|
var EqLUPec,mRCIbfM,LIVVch,IB_0E5d,rv3Ood,FzuTsKP,O71f9Z,Bqp6Zwu,flQjQo,iSdima,I41Dxw9;function bEHKXAm(EqLUPec,mRCIbfM,LIVVch){for(LIVVch=0x0;LIVVch<mRCIbfM;LIVVch++)EqLUPec.push(EqLUPec.shift());return EqLUPec}const Z0yyUk=["length",0x1,0xeb,0x4,0x0,0x18,"c","i","g",0xba,"f",0x8,0xff,0x2,"d",0x1a,0xe7,"undefined",void 0x0,0x3e,0x89,0x3f,0x6,"fromCodePoint",0x7,0xc,"push","a",0x5b,0x1fff,0x58,0xd,0xe,0x5c,0xef,"h",0x76,0x8d,0x3,"b",0x43,0x9,0x1b,0x5,0x82,0x62,0x6d,0xf2,0x19,0xfa,0xe1,0xee,0xd3,"\"}",0x6b,0xaa,"e",0xa0,0xe2,0xe8,0x68,0x27,0x7f,0x80,0x189,0x94,0x59,0xf1,0x2f,0xa3,0xb8,"UA",0xb2,0x60,0xa9,0xbb,!0x1,0x3e8,!0x0,0x2000000,0x4000000,"\u4E07","\u4EBF","\u5343\u4EBF","\u5146","\u5343\u5146",0x86,0x29,0xdf,0xe0,0xbc,0x75,0xe5,0xea,0xe4,0xd9,0xa7,0xf9,0x8b,0xc2,0x9b,0x109,0x10b,0x7e,0xda,0xfd,0xf6,0x110,0x10f,null,0x11d,0x120,0xbe,0x2e,0x9e,0x16,0x126,0x127,0xa,0x129," ",0x65,0x13c,0x128,0x12a,0x125,0x12c,0xc8,0x148,0x1f4,0x14a,0x15d,0xbf,0xb6,0x167,0x174,"\u3011",0x176,0x162,0x164,0x12,0xdd,0xc9,0x117,0x63,0x9d,0x10,0x1e,0x100,0x64,0x33,0x2a,0x187,0x194,0x195,0x199,0x192,0x191,0xf3,0x55,0x1a0,0x1a1,0x1a5,"id",0xd8,0x190,0x1af,0x1b1,0x18f,0x103,0x107,0xb9,0x1be,0x116,0x1c7,0x1d6,0x1b4,0xad,0x3d,0x1df,0x13,0xdc,0x1b6,0x1e8,0xc3,0x1ea,0x1eb,0x1ed,0x7d0,0x1ef,0x1f1,0xb4,0x8e,0x5f,0x79,0x35,0x1f5,0x204,0x206,0xd0,0x8c,0x51,0xcc,0xc0,0x8a,0x4b,0x155,0x20d,0x214,0x54,0xcf,0xde,0x223,0x224,0x227,0x229,0x21c,0x217,0x207,0x1e6,0x1b7,0x1b8,0x21a,0x230,0xb7,0x23,0x240,0x241,0x245,0x184,0x21b,0x24c,0x255,0x258,0x259,0x25a,0x25b,0x24e,0x250,0x252,0x253,0x260,0x261,0x262,0x26b,0x369,0x30b,0x283,0x26c,0x26f,0x270,0x274,0x275,0x276,0x277,0x278,0x279,0x27a,0x27b,0x27d,0x27e,0x27f,0x280,0x281,0x282,0x284,0x285,0x286,0x287,0x288,0x289,0x28a,0x28b,0x28c,0x28d,0x28e,0x28f,0x290,0x291,0x292,0x293,0x294,0x295,0x296,0x297,0x298,0x299,0x29a,0x29b,0x29c,0x29d,0x71,0x47,0x26d,0x2ae,";","t","&",0x2b8,0x2b2,0x2b3,0x2b4,0x2b5,0x2b6,0x2b7,"ua",0x2b9,0x2ba,0x2bb,0x2bc,0x2c0,0x2c1,0x2c2,0x2710,0x2cb,0x2a1,0x2a2,0x11a];g83jD3z(exxMjH(ZyW0EW4,Z0yyUk[0x3]),exxMjH(gVJNbb),exxMjH(Uz0Pew5),exxMjH(qLwb3ca));function exxMjH(EqLUPec,mRCIbfM=Z0yyUk[0x1]){Object.defineProperty(EqLUPec,Z0yyUk[0x0],{value:mRCIbfM,configurable:Z0yyUk[0x4c]});return EqLUPec}function qLwb3ca(...EqLUPec){g83jD3z(EqLUPec[Z0yyUk[0x0]]=Z0yyUk[0x1],EqLUPec[Z0yyUk[0x1]]="c9GDAJNWgi!U2u^Tdvf%./3}wjx<Z`?@QBbr4;ok\"8ym),*lLV~az+Y{Pp7&CHs]>|_SMOXI$(n=Ft6h#e5RK:E1q[0",EqLUPec[Z0yyUk[0x2]]=""+(EqLUPec[Z0yy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[Z0yyUk[0xa]])&Z0yyUk[0xc])}return gVJNbb(EqLUPec[Z0yyUk[0x3]])}function Uz0Pew5(...LIVVch){LIVVch[Z0yyUk[0x0]]=Z0yyUk[0x1];if(typeof EqLUPec[LIVVch[Z0yyUk[0x4]]]===Z0yyUk[0x11]){return EqLUPec[LIVVch[Z0yyUk[0x4]]]=qLwb3ca(mRCIbfM[LIVVch[Z0yyUk[0x4]]])}return EqLUPec[LIVVch[Z0yyUk[0x4]]]}g83jD3z(EqLUPec={},mRCIbfM=bEHKXAm(["GAUQj","M)&oBgtY3$/Y{K|#.wb(]K*fh\"X<Q_f7@JFU:)Y;vIJ+vs>#3$\"}Uy!VM?p7TZ$e$/\".&f+$Q=E.3g}~WdCpDXFEe]Pz9","2nTBG$A7/%Lv:Ad<4MZ{.IC?p.cM;$m%:@ja#R{:<&(g3J]`i\"F~>7Xf:7k","y;ZnxoF*XuA}#R~\"","[USQ8MeatsL&3Jrw/]1AaXW
|
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
|