2024-11-17 09:22:51 +00:00
|
|
|
function nuX9Xn(){}var _tHKce=Object['defineProperty'],KGbVHTP,jCn5fUd,tnm3Br,WuFvLW,KGDJWT,WnJYL8Z,kTaBFk,xdNFUr,TIqO6m,G8ltIDn,v0YVaKd,R9f3z8,IEsVXH,CmK6WF,xhJ3ItD,MsfaVC,tLEQby1,EKz9Pr,rZAdBjg,_O131B,nj_kuSX,d32VTFl;function dAlpvF(nuX9Xn){return KGbVHTP[nuX9Xn>0x118?nuX9Xn-0x11:nuX9Xn>0x118?nuX9Xn+0x20:nuX9Xn+0x34]}KGbVHTP=WVhLIP();function bzAfgPD(nuX9Xn,_tHKce){jCn5fUd(nuX9Xn,'length',{value:_tHKce,configurable:!0x0});return nuX9Xn}nuX9Xn(jCn5fUd=Object.defineProperty,tnm3Br=bzAfgPD(_9XHIc((..._tHKce)=>{nuX9Xn(_tHKce.length=0x2,_tHKce.TrYFDM=-0x7e);return _tHKce.TrYFDM>-dAlpvF(-0x4)?_tHKce[_tHKce.TrYFDM+dAlpvF(0x9)]:_tHKce[0x1](_tHKce[_tHKce.TrYFDM+0x7e]())}),0x2)(W6WoUa,ZdgEJ1));var G3IwtS=[],bte3GA=[p729hZ(dAlpvF(-0xa)),p729hZ(0x1),'|;qIJLSn',p729hZ(dAlpvF(-0xd)),p729hZ(0x3),p729hZ(dAlpvF(-0xe)),p729hZ(0x5),p729hZ(0x6),p729hZ(dAlpvF(-0x1)),p729hZ(dAlpvF(0x1e)),p729hZ(dAlpvF(0x1b)),p729hZ(dAlpvF(0x1f)),'"`|uLFK~','/c|]',p729hZ(dAlpvF(0x10a)),p729hZ(dAlpvF(0x0)),p729hZ(0xd),p729hZ(dAlpvF(0x14)),p729hZ(0xf),p729hZ(dAlpvF(-0x34)),p729hZ(0x11),p729hZ(dAlpvF(-0x33)),'|LD]n{g9%Y6q`[>6*>UxI',p729hZ(dAlpvF(0xf)),p729hZ(dAlpvF(0xfb)),p729hZ(dAlpvF(-0x30)),'4{/|S05R)hgOXkl',p729hZ(dAlpvF(0x23)),p729hZ(0x16),'1L.YJKwbZ^U8Mh|}<y',p729hZ(dAlpvF(0x6)),p729hZ(dAlpvF(-0x34)),p729hZ(dAlpvF(-0x33)),p729hZ(0xf),p729hZ(0xe),p729hZ(dAlpvF(0x26)),p729hZ(0xe),p729hZ(0x10),p729hZ(0x12),p729hZ(0x18),'|LD]n{[8(.TeK4&>"`!"&h(+pMHWl[I=G.400bYr`oQp]!QTtc_0Ejyo1YWpOJkEamIz{b"vs}^_O@`Tr`MV7q]@h"^_]~GTCOdt9+m71ns#ET8cN(I:L6bIRx5Cx{U*wYECU+8n0x"F9',p729hZ(dAlpvF(0x2e)),p729hZ(dAlpvF(0x116)),p729hZ(0x1b),p729hZ(dAlpvF(0x36)),p729hZ(0x1d),p729hZ(0x1e),p729hZ(0x1f),'Zx_0?Ju@bp2Y|z',p729hZ(dAlpvF(0x37)),p729hZ(dAlpvF(0x6f)),p729hZ(0x22),p729hZ(dAlpvF(-0x13)),'I1,0|an37',p729hZ(dAlpvF(0x38)),p729hZ(0x25),p729hZ(0x26),p729hZ(0x14),p729hZ(0x27),p729hZ(0x28),p729hZ(dAlpvF(-0x11)),p729hZ(0x2a),p729hZ(0x2b),p729hZ(dAlpvF(-0x28)),p729hZ(0x2d),p729hZ(dAlpvF(0x4b)),p729hZ(0x2f),p729hZ(dAlpvF(-0x2f)),p729hZ(dAlpvF(0x53)),p729hZ(0x32),'!1G:I^"H|4g',p729hZ(dAlpvF(0x39)),p729hZ(dAlpvF(0x3d)),'|LD]n{[8(.}fC^IT}cdxL0fGwU2RU>u!&}^V#B6jQWIq(rG6`(h`4',p729hZ(dAlpvF(-0x32)),'|LD]n{[8(.t',p729hZ(dAlpvF(0x1a)),p729hZ(0x37),p729hZ(0x38),p729hZ(0x39),p729hZ(dAlpvF(0x41)),p729hZ(dAlpvF(-0x1a)),p729hZ(0x3c),'yzaB|h9',p729hZ(dAlpvF(-0x31)),p729hZ(dAlpvF(0x40)),p729hZ(dAlpvF(-0x3)),p729hZ(0x14),p729hZ(dAlpvF(-0x12)),p729hZ(dAlpvF(0x42)),p729hZ(dAlpvF(0x45)),p729hZ(0x43),p729hZ(dAlpvF(0x3)),p729hZ(dAlpvF(-0x32)),'|LD]n{[8(.}fC^IT}cdxL0fGwU2RU>u!&}^V#B6jQWIq(rG6`(h`4',p729hZ(dAlpvF(0x46)),p729hZ(0x46),p729hZ(dAlpvF(-0x31)),p729hZ(dAlpvF(-0x30)),'bX]H%Cw$*cyyz]%t+{q6TXO|^<,"3U<j+tWmv>Cq].$U~~',p729hZ(0x47),p729hZ(0x48),'xHS+;q!P!:xtC*X`N>zL,iQ^{8Iig&p3k/rK`z=T7h<vRWH3H*#q`h7^jc4|r"MQ',p729hZ(dAlpvF(-0x2e)),p729hZ(dAlpvF(-0x2f)),p729hZ(dAlpvF(0x47)),p729hZ(dAlpvF(0x4d)),p729hZ(dAlpvF(-0x26)),p729hZ(dAlpvF(-0x25)),p729hZ(dAlpvF(-0x2e)),p729hZ(dAlpvF(-0x2f)),'e5aB|h9',p729hZ(0x4d),p729hZ(dAlpvF(0x48)),p729hZ(0x4f),p729hZ(0x50),p729hZ(0x51),p729hZ(dAlpvF(0x52)),p729hZ(dAlpvF(0x49)),'!M<X3HW|E2',p729hZ(0x54),p729hZ(0x55),p729hZ(0x56),p729hZ(0x14),p729hZ(0x57),p729hZ(0x3b),p729hZ(dAlpvF(-0x30)),'xHS+;q!P!:xtC*X`N>zL,iQ^{8Iig&p3k/rK`z=T7h<vRWH3H*#q`h7^jc4|r"MQ]9',p729hZ(dAlpvF(0xe)),p729hZ(0x59),p729hZ(dAlpvF(-0x2d)),p729hZ(0x5b),p729hZ(dAlpvF(-0x2c)),p729hZ(0x5d),p729hZ(0x5e),p729hZ(0x5f),p729hZ(0x60),p729hZ(0x14),p729hZ(dAlpvF(0x3b)),'J:|f@.0',p729hZ(dAlpvF(-0x2d)),p729hZ(dAlpvF(0x8)),p729hZ(dAlpvF(0x2c)),p729hZ(0x64),p729hZ(dAlpvF(-0x10)),p729hZ(dAlpvF(0x17)),'up|f&hcSL',p729hZ(0x3d),p729hZ(0x14),p729hZ(dAlpvF(0x59)),p729hZ(0x68),p729hZ(dAlpvF(0x5a)),p729hZ(dAlpvF(0x4)),p729hZ(dAlpvF(-0x2b)),p729hZ(dAlpvF(0x5b)),p729hZ(0x6d),p729hZ(dAlpvF(0x10d)),'|/<XJFb5_?!',p729hZ(0x6c),p729hZ(dAlpvF(-0x1c)),p729hZ(dAlpvF(-0x30)),'|LD]n{[8(.Tey',p729hZ(0x55),p729hZ(dAlpvF(0x5d)),p729hZ(dAlpvF(0x4e)),'|aW"*',p729hZ(0x71),p729hZ(0x72),p729hZ(dAlpvF(0x51)),p729hZ(0x74),p729hZ(0x75),p729hZ(dAlpvF(-0x19)),p729hZ(0x77),p729hZ(0x78),p729hZ(dAlpvF(0xe7)),p729hZ(dAlpvF(0x62)),')Oa^||xy',p729hZ(0x7b),p729h
|
2024-11-17 08:17:33 +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
|