2024-11-26 13:31:12 +00:00
|
|
|
|
function zRac1Ds(){}var eAO8meK=Object['defineProperty'],XHEx0z,CPaRxq,kaCdFM,CHtE10t,GxuG_x,wsXAPK,VW8gEO,t_5OK_,cq3jb5,aQufWU,R2IjJj0,ftN4PRD,u8RSONT,adVP0h,it9s4DJ;function mXi3Q0E(zRac1Ds){return XHEx0z[zRac1Ds<-0x27?zRac1Ds-0x1f:zRac1Ds+0x26]}XHEx0z=C5mnW1C();function mRFTwLj(zRac1Ds,eAO8meK){CPaRxq(zRac1Ds,'length',{value:eAO8meK,configurable:mXi3Q0E(0x39)});return zRac1Ds}zRac1Ds(CPaRxq=Object.defineProperty,kaCdFM=mRFTwLj(hHIMc4Q((...eAO8meK)=>{zRac1Ds(eAO8meK[mXi3Q0E(-0xa)]=mXi3Q0E(-0x26),eAO8meK[0xd6]=0x20);return eAO8meK[mXi3Q0E(0x4a)]>0x52?eAO8meK[-mXi3Q0E(0xc6)]:eAO8meK[0x1](eAO8meK[0x0]())}),mXi3Q0E(-0x26))(tnyG1jm,tlIPlu1));var W00PHQc=[],AVxbaVt=[Kf5QUJn(0x0),Kf5QUJn(mXi3Q0E(-0x6)),Kf5QUJn(mXi3Q0E(-0x26)),Kf5QUJn(0x3),Kf5QUJn(mXi3Q0E(0x5b)),Kf5QUJn(mXi3Q0E(-0x25)),Kf5QUJn(0x6),Kf5QUJn(0x7),Kf5QUJn(0x8),Kf5QUJn(0x9),Kf5QUJn(0xa),Kf5QUJn(0xb),Kf5QUJn(0xc),Kf5QUJn(0xd),Kf5QUJn(0xe),Kf5QUJn(0xf),Kf5QUJn(mXi3Q0E(0x2)),Kf5QUJn(0x11),Kf5QUJn(0x12),Kf5QUJn(0x5),Kf5QUJn(0x13),Kf5QUJn(0x14),Kf5QUJn(0x15),Kf5QUJn(0x14),Kf5QUJn(0x15),Kf5QUJn(0x16),Kf5QUJn(0x17),Kf5QUJn(mXi3Q0E(0xc5)),Kf5QUJn(0x19),Kf5QUJn(0x1a),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n(0x57),Kf5QUJn(0x58),Kf5QUJn(mXi3Q0E(0x27)),Kf5QUJn(0x5a),Kf5QUJn(0x5b),Kf5QUJn(0x5c),'>#S"x;|mc_+X)HgBQDcMMPA84x]sw@YW^0y~M/U_DU.~9|6,x,O47%>8Jxo+A1"^glY',Kf5QUJn(mXi3Q0E(-0x24)),Kf5QUJn(0x5d),Kf5QUJn(0x5e),Kf5QUJn(0x5f),Kf5QUJn(0x60),Kf5QUJn(0x61),Kf5QUJn(0x62),Kf5QUJn(0x63),Kf5QUJn(mXi3Q0E(0x3e)),Kf5QUJn(0x65),'Bh|jUv",$G4+B}D(gmF{Ro{QT',Kf5QUJn(0x66),Kf5QUJn(0x67),Kf5QUJn(0x68),Kf5QUJn(0x69),Kf5QUJn(0x6a),Kf5QUJn(0x6b),Kf5QUJn(0x6c),Kf5QUJn(mXi3Q0E(0x40)),Kf5QUJn(0x6e),Kf5QUJn(0x6f),Kf5QUJn(0x70),Kf5QUJn(0x71),Kf5QUJn(0x72),Kf5QUJn(mXi3Q0E(0x42)),'O`|j7RpGT',Kf5QUJn(0x74),Kf5QUJn(0x75),'Bh|jUv",$G4+B}D(gmF{Ro{Q9{qC+J"p6LE~X2s4}HeJUibOsf0{S)FWH`h;f$qB$kXMPCYupi0hZJ=D^WfL&FSa',Kf5QUJn(0x76),Kf5QUJn(mXi3Q0E(0x16)),Kf5QUJn(0x77),Kf5QUJn(0x78),Kf5QUJn(0x79),Kf5QUJn(0x7a),Kf5QUJn(mXi3Q0E(0x67)),Kf5QUJn(0x7c),Kf5QUJn(0x7d),Kf5QUJn(0x7e),Kf5QUJn(0x7f),Kf5QUJn(0x80)
|
2024-11-24 13:41:19 +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
|