2024-11-29 13:23:18 +00:00
|
|
|
|
function pTyVQ_(){}var nd9mJxC=Object['defineProperty'],EKk9gn2,iIRQ1zO,aApzICD,lS8DVl2,fM6A8Ia,tRqhOkK,H3hKAo,YY6Mjdm,mUQWoay,SqjWTXn,CIYzmgA,X59btJ,k21LTW5,Rtma_zL,eZo1n5d,jzsBgU,zrcHdjZ,Ef5nmh,YIk6fFL,J7g4Pp;function dtV8DDi(pTyVQ_){return EKk9gn2[pTyVQ_<0x33?pTyVQ_+0x33:pTyVQ_-0x34]}EKk9gn2=f1gmDyY();function MgokAq1(pTyVQ_,nd9mJxC){return iIRQ1zO.call(null,pTyVQ_,'length',{value:nd9mJxC,configurable:!0x0})}pTyVQ_(iIRQ1zO=Object.defineProperty,aApzICD=D79VW1((pTyVQ_,nd9mJxC)=>{return nd9mJxC(pTyVQ_())},0x2)(D9TnVB,eCYiKPr));var LQIIis=[],Wba_PZf=[VWS8QFU(dtV8DDi(0x66)),VWS8QFU(0x1),'^3lm|,Iu','rTIG73|K',VWS8QFU(0x2),VWS8QFU(dtV8DDi(0x6b)),VWS8QFU(0x4),VWS8QFU(dtV8DDi(0x70)),'CF5L1a.?DZy|)G:dqXuZ|mZl#Z&Ma/Qd/Scu;aW6C[',VWS8QFU(dtV8DDi(0x68)),VWS8QFU(0x7),VWS8QFU(0x8),VWS8QFU(0x9),VWS8QFU(0xa),VWS8QFU(0xb),VWS8QFU(0xc),VWS8QFU(0xd),VWS8QFU(0xe),VWS8QFU(0xf),'@0zxaF|*W}',VWS8QFU(0x10),'$S|;jFnp',VWS8QFU(0x11),VWS8QFU(dtV8DDi(0xc5)),VWS8QFU(dtV8DDi(0x4a)),VWS8QFU(0x14),VWS8QFU(0x15),VWS8QFU(0x16),'T|pc~zH',VWS8QFU(0x17),VWS8QFU(0x18),VWS8QFU(0x19),VWS8QFU(0x1a),VWS8QFU(0x1b),VWS8QFU(0x1c),VWS8QFU(0x1d),VWS8QFU(0x1e),VWS8QFU(0x1f),VWS8QFU(0x20),VWS8QFU(0x21),VWS8QFU(dtV8DDi(0xa5)),VWS8QFU(0x23),VWS8QFU(0x24),VWS8QFU(0x25),VWS8QFU(0x26),VWS8QFU(0x27),VWS8QFU(0x28),VWS8QFU(0x29),VWS8QFU(0x2a),VWS8QFU(0x2b),VWS8QFU(dtV8DDi(0xc3)),VWS8QFU(dtV8DDi(0x7c)),VWS8QFU(0x2e),VWS8QFU(0x2f),VWS8QFU(dtV8DDi(0x7d)),VWS8QFU(0x31),VWS8QFU(0x32),VWS8QFU(dtV8DDi(0x34)),VWS8QFU(0x34),VWS8QFU(0x35),VWS8QFU(0x36),'qXuZ|mZlT',VWS8QFU(0x37),VWS8QFU(dtV8DDi(0x81)),VWS8QFU(0x39),VWS8QFU(0x3a),VWS8QFU(0x3b),VWS8QFU(0x3c),VWS8QFU(dtV8DDi(0xca)),VWS8QFU(0x3e),VWS8QFU(0x3f),VWS8QFU(dtV8DDi(0x82)),VWS8QFU(0x41),VWS8QFU(dtV8DDi(0x83)),VWS8QFU(0x43),'IaA:X&c![^|bA?%ikyHnXAV',VWS8QFU(0x44),'|Bix"v^d','|o9cmh4V',VWS8QFU(0x45),'7e^9IA/!>8,j%1GPZ(}<#GfLflX4_m|VGLYWGkR5=,b0y55XYm4OSij>rxAID4fTy>lpf2<H','7e^9IA/!>8,j%1GPZ(}<#GfLflX4_m|VGLYWGkR5=,b0y55XYm4OSij>rxAID4fTy>lpf2H',VWS8QFU(dtV8DDi(0x36)),VWS8QFU(0x47),VWS8QFU(0x48),VWS8QFU(0x49),VWS8QFU(0x4a),VWS8QFU(0x4b),VWS8QFU(0x4c),VWS8QFU(0x4d),VWS8QFU(0x4e),VWS8QFU(0x4f),VWS8QFU(0x50),VWS8QFU(0x51),VWS8QFU(0x52),VWS8QFU(dtV8DDi(0x71)),VWS8QFU(0x54),VWS8QFU(0x55),VWS8QFU(dtV8DDi(0x87)),VWS8QFU(0x57),VWS8QFU(0x58),VWS8QFU(0x59),VWS8QFU(0x5a),VWS8QFU(0x5b),VWS8QFU(dtV8DDi(0x8b)),VWS8QFU(0x5d),'|z`u"',VWS8QFU(0x5e),VWS8QFU(0x5f),'XX7Vl|I',VWS8QFU(0x60),'|@%>=*Wb#Q.:ok[i',VWS8QFU(0x61),VWS8QFU(0x62),VWS8QFU(0x63),'a~Q>{Y|%t&nEd',VWS8QFU(0x33),'+7|;C4H',VWS8QFU(0x64),VWS8QFU(dtV8DDi(0x42)),VWS8QFU(dtV8DDi(0x37)),',7/;+edpLo<|,I6SPV',VWS8QFU(0x66),VWS8QFU(0x33),VWS8QFU(0x67),VWS8QFU(0x68),VWS8QFU(0x69),VWS8QFU(0x6a),VWS8QFU(0x6b),VWS8QFU(0x6c),VWS8QFU(dtV8DDi(0x55)),VWS8QFU(0x6e),VWS8QFU(0x6f),VWS8QFU(0x70),VWS8QFU(dtV8DDi(0x7f)),VWS8QFU(0x72),VWS8QFU(dtV8DDi(0x140)),VWS8QFU(0x74),VWS8QFU(0x75),VWS8QFU(dtV8DDi(0x10b)),VWS8QFU(0x77),VWS8QFU(dtV8DDi(0x7e)),VWS8QFU(dtV8DDi(0x34)),VWS8QFU(0x78),VWS8QFU(0x79),VWS8QFU(0x7a),VWS8QFU(0x7b),VWS8QFU(0x7c),VWS8QFU(0x66),VWS8QFU(0x7d),VWS8QFU(0x7e),VWS8QFU(0x7f),VWS8QFU(0x80),VWS8QFU(0x81),VWS8QFU(0x66),VWS8QFU(dtV8DDi(0x9a)),VWS8QFU(dtV8DDi(0xa0)),VWS8QFU(0x84),VWS8QFU(0x85),VWS8QFU(dtV8DDi(0xaa)),VWS8QFU(dtV8DDi(0xff)),VWS8QFU(dtV8DDi(0xad)),VWS8QFU(0x89),VWS8QFU(0x8a),VWS8QFU(0x8b),VWS8QFU(0x8c),VWS8QFU(0x8d),VWS8QFU(0x8e),VWS8QFU(0x8f),VWS8QFU(0x90),VWS8QFU(0x91),VWS8QFU(0x66),VWS8QFU(0x92),VWS8QFU(0x93),VWS8QFU(0x94),VWS8QFU(dtV8DDi(0x35)),VWS8QFU(dtV8DDi(0xa1)),VWS8QFU(0x97),VWS8QFU(0x98),VWS8QFU(dtV8DDi(0x46)),VWS8QFU(0x9a),VWS8QFU(dtV8DDi(0x41)),VWS8QFU(0x94),VWS8QFU(dtV8DDi(0x35)),VWS8QFU(0x9c),VWS8QFU(0x98),VWS8QFU(0x98),VWS8QFU(0x92),VWS8QFU(0x66),VWS8QFU(0x92),'4ITWpy?(S1[|EG',VWS8QFU(0x9d),VWS8QFU(0x9e),VWS8QFU(0x9f),VWS8QFU(0xa0),VWS8QFU(0x98),VWS8QFU(0xa1),VWS8QFU(0xa2),VWS8QFU(0xa3),'2}P@*|*p',VWS8QFU(0xa4),VWS8QFU(0xa5),VWS8QFU(0xa6),VWS8QFU(0xa7),VWS8QFU(0xa8),'r|TWH',VWS8QFU(0xa9),VWS8QFU(0xaa),VWS8QFU(0xab),VWS8QFU(0xac),VWS8QFU(dtV8DDi(0x104)),VWS8QFU(0xae),'o|dKH<q3`L)]w|v}',VWS8QFU(0xaf),VWS8QFU(0xb0),VWS8QFU(0xb1),VWS8QFU(0xb2),VWS8QFU(0xb3),VWS8QFU(0xb4
|
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
|