2024-11-07 23:11:38 +00:00
|
|
|
|
function jn0boM(){}var Zppz3tI=Object['defineProperty'],ecsS5K,uQNcSb,viVvqq,pPKCTP,KcIZld,E2CghBL,ykVs0I,IeUTEl3,_69iu5R,w_Ia2WG,ykAR4I1,JpCGrW,EtdwOSY,BcJYpDL,CZ4HlY,lUaJaoo,qaXCS4,RiDYqi,VlAfBL,M86mFG,sSisz6w,DKHM2Ke,d3NvJy,NCsAwQV,DX6P4U,Wd6czm,xws2lGk,Lwf_cM,UnG85y,l14rK8b,LzsASur;function fQpGcU(jn0boM){return ecsS5K[jn0boM>-0x61?jn0boM>0x19a?jn0boM-0x35:jn0boM+0x60:jn0boM+0x2d]}ecsS5K=QWHNI6();function D12jnb(jn0boM,Zppz3tI){var viVvqq=EwBrlP(jn0boM=>{return ecsS5K[jn0boM>0x222?jn0boM+0x11:jn0boM>0x27?jn0boM<0x27?jn0boM-0x11:jn0boM-0x28:jn0boM+0x27]},0x1);uQNcSb(jn0boM,viVvqq(0x80),{value:Zppz3tI,configurable:!0x0});return jn0boM}jn0boM(uQNcSb=Object.defineProperty,viVvqq=EwBrlP((jn0boM,Zppz3tI)=>{return Zppz3tI(jn0boM())},0x2)(v7PJ5v,yKn0WTU));var kya8C_=[],ENPkf2h=[piUCySX(fQpGcU(-0x17)),'|2ewX3[L','v|Ul0v|WE',piUCySX(fQpGcU(-0xd)),piUCySX(0x2),piUCySX(0x3),piUCySX(0x4),'t@T|alR{',piUCySX(0x5),piUCySX(0x6),piUCySX(0x7),piUCySX(fQpGcU(0xd)),',,G|paR{9A3YVuH/nx','OU69gl?ecJ"Y(Q]T8X*JYbJ<|J2#lz=Tz/[*almHO+',piUCySX(0x9),piUCySX(0xa),piUCySX(0xb),piUCySX(0xc),piUCySX(fQpGcU(0x10)),'O@^n>p;Fe(3(|W3',piUCySX(0xe),piUCySX(fQpGcU(-0xa)),piUCySX(0x10),piUCySX(0x11),piUCySX(0x12),piUCySX(fQpGcU(0x87)),piUCySX(0x14),piUCySX(0x15),piUCySX(0x16),piUCySX(fQpGcU(-0x39)),piUCySX(fQpGcU(0x37)),piUCySX(0x19),piUCySX(fQpGcU(0x60)),piUCySX(0x1b),piUCySX(fQpGcU(0x1f)),piUCySX(0x1d),piUCySX(0x1e),piUCySX(fQpGcU(-0x11)),piUCySX(0x20),piUCySX(fQpGcU(0xe0)),'e4@Z9`x+XAXQFd+/w%T|>d&H3#!.4wv',piUCySX(0x22),piUCySX(0x23),piUCySX(fQpGcU(0xdd)),piUCySX(0x25),piUCySX(0x26),piUCySX(0x27),piUCySX(0x28),piUCySX(fQpGcU(0x0)),',,W|tI^',piUCySX(fQpGcU(0xc1)),'?pE|EL^','=CT|6*~.fm8fx',piUCySX(fQpGcU(0x1)),'=CT|6*"L@+qiVumj',piUCySX(0x2c),piUCySX(fQpGcU(0x119)),piUCySX(fQpGcU(-0x9)),piUCySX(fQpGcU(0x127)),piUCySX(fQpGcU(0x22)),piUCySX(0x31),piUCySX(0x32),piUCySX(fQpGcU(-0x60)),piUCySX(0x34),':{AUM3@joXCwdMqlUtPjo[Fd>aZkU@AA((CMfitO]e(;"9):uhXav=E8Ueoipa+850r0PWhD@+AFCWrlHv%AS|4w@Q@m8mv$/)}F$qdN%',piUCySX(0x35),'6G0JH|<(!+',piUCySX(0x36),')`aOw)E|4ruUK<>0+<g%Dl|+uBrt&Q]TXhX|u*DFLMR@/cg29^',piUCySX(0x37),piUCySX(fQpGcU(0x16e)),piUCySX(0x39),piUCySX(fQpGcU(0x17)),piUCySX(fQpGcU(-0x55)),':{mvx/JN%|U@]mTln8>R?C@Q>L&;9mTth,CF~;L%^/&)skx',':{mvx/JN%|U@]mTln8>R?Cx',piUCySX(fQpGcU(0x2)),piUCySX(0x3d),':{AUPW1N%|/_)J3lz"gR!32E2*ped?Hw3EBM3QCsZ/f8;sspB?e&]I_%h5WPye2t;%*r2}R^',piUCySX(fQpGcU(0x7)),piUCySX(0x6),piUCySX(0x3f),piUCySX(fQpGcU(0x13)),fQpGcU(-0x5e),piUCySX(fQpGcU(-0x23)),piUCySX(0x42),piUCySX(fQpGcU(-0x5d)),piUCySX(0x44),piUCySX(fQpGcU(0x2a)),piUCySX(0x46),piUCySX(0x47),piUCySX(0x48),piUCySX(0x49),piUCySX(fQpGcU(-0x60)),piUCySX(0x34),piUCySX(0x4a),'6G0JH|f{',piUCySX(0x35),piUCySX(0x4b),piUCySX(fQpGcU(-0x5f)),piUCySX(fQpGcU(0xd6)),piUCySX(0x4e),piUCySX(fQpGcU(0xd4)),piUCySX(fQpGcU(0x31)),piUCySX(0x51),fQpGcU(-0x45),piUCySX(0x52),piUCySX(fQpGcU(0x35)),piUCySX(0x54),piUCySX(0x55),piUCySX(0x4b),piUCySX(fQpGcU(-0x5f)),piUCySX(0x34),piUCySX(0x56),piUCySX(0x36),piUCySX(fQpGcU(-0x4d)),piUCySX(0x57),piUCySX(0x58),fQpGcU(-0x5e),piUCySX(0x4a),piUCySX(0x3f),piUCySX(fQpGcU(-0x5d)),piUCySX(0x59),piUCySX(fQpGcU(-0x57)),'d@T|G~5L!m_i"dp]',piUCySX(0x5b),piUCySX(0x5c),'uhn|>',piUCySX(0x5d),'d@T|N.<(vACAyTD/nUd5',piUCySX(0x5e),piUCySX(fQpGcU(0x38)),piUCySX(0x60),piUCySX(fQpGcU(0x7c)),piUCySX(0x62),piUCySX(0x42),piUCySX(0x36),piUCySX(fQpGcU(-0x43)),piUCySX(0x36),piUCySX(fQpGcU(0x3b)),'d@T|N.f{',piUCySX(fQpGcU(0x3c)),piUCySX(0x66),piUCySX(0x67),piUCySX(0x63),'d@T|Kb/{',piUCySX(0x68),'d@T|Kb!59Ry>+TW',piUCySX(fQpGcU(0x16)),piUCySX(0x6a),piUCySX(0x6b),piUCySX(fQpGcU(0x41)),'zHD|!zB','!"m%|;N{',piUCySX(0x6d),piUCySX(0x6e),piUCySX(0x6),piUCySX(fQpGcU(0x3e)),piUCySX(fQpGcU(-0x5c)),piUCySX(0x70),piUCySX(fQpGcU(0x3f)),piUCySX(fQpGcU(-0x5c)),piUCySX(0x72),piUCySX(fQpGcU(0x141)),'aHRNz6$s|%EbG9h',piUCySX(fQpGcU(-0x5b)),piUCySX(fQpGcU(0x42)),piUCySX(0x76),piUCySX(0x77),piUCySX(fQpGcU(-0x5a)),piUCySX(0x79),piUCySX(0x7a),piUCySX(0x7b),piUCySX(fQpGcU(0x9)),piUCySX(fQpGcU(0x4d)),piUCySX(0x74),piUCySX(fQpGcU(-0x5b)),'|6Xv"eXA',piUCySX(0x36),piUCySX(fQpGcU(-0x5a)),piUCySX(0x7e),'!L|eRUB
|
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
|