2024-11-27 13:36:56 +00:00
|
|
|
function nJbeZK(){}var rIBtGzs=Object['defineProperty'],IZdWIM9,H8xauaK,v3zxFsT,TKXuer7,zyFrxRM,p4qa8N2,pqM7lm,ZoU35R,CjkV5WN,bxxpOi,tx_ss7,dumepH,KD20w3,uWD5rSR,c86G68C,YMwjda4,hXErxT,uMUYJIE,HlXoRk,Wg_JCsw,DH3GSfr,SQliMcS,yfk6154;function iD1wVOO(nJbeZK){return IZdWIM9[nJbeZK<0x19b?nJbeZK<0x19b?nJbeZK-0x62:nJbeZK-0x43:nJbeZK+0x1a]}IZdWIM9=bl0jQSb();function iCbt5x(nJbeZK,rIBtGzs){var v3zxFsT=sGQ5Hb(nJbeZK=>{return IZdWIM9[nJbeZK<0xe?nJbeZK+0x2b:nJbeZK>0xe?nJbeZK>0xe?nJbeZK-0xf:nJbeZK+0xc:nJbeZK+0x1f]},0x1);return H8xauaK.call(v3zxFsT(0x3c),nJbeZK,'length',{value:rIBtGzs,configurable:!0x0})}nJbeZK(H8xauaK=Object.defineProperty,v3zxFsT=sGQ5Hb((nJbeZK,rIBtGzs)=>{return rIBtGzs(nJbeZK())},0x2)(sp4xyQ,_XoRgC));var vxpqoE=[],dehMrP=[pgz62fq(0x0),pgz62fq(0x1),pgz62fq(0x2),pgz62fq(0x3),pgz62fq(iD1wVOO(0x79)),pgz62fq(0x5),pgz62fq(iD1wVOO(0x80)),pgz62fq(0x7),pgz62fq(iD1wVOO(0x89)),pgz62fq(0x9),pgz62fq(0xa),pgz62fq(0xb),pgz62fq(0xc),pgz62fq(0xb),pgz62fq(0xc),pgz62fq(iD1wVOO(0x87)),pgz62fq(0xe),pgz62fq(0xf),pgz62fq(0x10),pgz62fq(iD1wVOO(0x95)),pgz62fq(0x12),pgz62fq(iD1wVOO(0x10c)),pgz62fq(0x14),pgz62fq(0x15),pgz62fq(0x16),'PP|cCmb',pgz62fq(0x17),pgz62fq(0x18),pgz62fq(iD1wVOO(0x147)),pgz62fq(0x1a),pgz62fq(0x1b),pgz62fq(0x1c),pgz62fq(0x1d),pgz62fq(0x1e),pgz62fq(0x1f),pgz62fq(0x20),pgz62fq(0x21),pgz62fq(0x22),pgz62fq(0x23),pgz62fq(0x24),pgz62fq(0x25),pgz62fq(0x26),pgz62fq(0x27),pgz62fq(0x28),pgz62fq(0x29),pgz62fq(iD1wVOO(0x175)),pgz62fq(0x2b),pgz62fq(0x2c),pgz62fq(0x2d),pgz62fq(0x2e),pgz62fq(0x25),pgz62fq(0x2f),pgz62fq(iD1wVOO(0x146)),pgz62fq(0x31),pgz62fq(0x32),pgz62fq(0x2d),pgz62fq(iD1wVOO(0xa2)),'IB?h0?EYUw|,a0vB@2G_Ngu',pgz62fq(0x34),pgz62fq(0x35),pgz62fq(0x36),pgz62fq(0x37),pgz62fq(0x25),pgz62fq(0x38),pgz62fq(0x39),pgz62fq(0x3a),pgz62fq(0x3b),pgz62fq(0x3c),pgz62fq(0x25),pgz62fq(0x3d),'6kg#eGyB@ZR&5I;9f.|k',pgz62fq(iD1wVOO(0x62)),pgz62fq(iD1wVOO(0x81)),pgz62fq(iD1wVOO(0x8b)),pgz62fq(0x41),pgz62fq(0x42),pgz62fq(0x43),pgz62fq(iD1wVOO(0xc5)),pgz62fq(0x3f),'o`P=$a5&h4Mi|Gz[sKM',pgz62fq(iD1wVOO(0x8c)),pgz62fq(0x46),pgz62fq(0x47),pgz62fq(0x48),pgz62fq(0x49),pgz62fq(iD1wVOO(0x62)),pgz62fq(iD1wVOO(0xad)),pgz62fq(0x4b),pgz62fq(iD1wVOO(0x14a)),pgz62fq(0x4d),pgz62fq(0x4e),'5Pzc#UC`o|l)yoIV+Pq;m<b',pgz62fq(0x25),pgz62fq(0x4f),pgz62fq(iD1wVOO(0xaf)),pgz62fq(0x25),pgz62fq(iD1wVOO(0xbb)),pgz62fq(iD1wVOO(0xb1)),pgz62fq(iD1wVOO(0xb2)),pgz62fq(iD1wVOO(0x62)),pgz62fq(0x54),pgz62fq(0x55),pgz62fq(0x56),pgz62fq(0x57),pgz62fq(0x58),pgz62fq(0x59),pgz62fq(0x5a),'F|&vq/Q.','2%6>|Bb','F|&vZ3Q.',pgz62fq(0x5b),pgz62fq(0x5c),pgz62fq(iD1wVOO(0x7b)),pgz62fq(iD1wVOO(0xd9)),'x.wNMtT|_5',pgz62fq(0x5f),pgz62fq(iD1wVOO(0xbc)),pgz62fq(iD1wVOO(0x112)),pgz62fq(0x62),pgz62fq(0x25),pgz62fq(iD1wVOO(0xdf)),pgz62fq(0x64),pgz62fq(0x65),pgz62fq(iD1wVOO(0xbd)),pgz62fq(0x67),pgz62fq(0x68),pgz62fq(0x25),pgz62fq(iD1wVOO(0x67)),pgz62fq(0x6a),pgz62fq(0x6b),pgz62fq(0x6c),pgz62fq(0x5b),pgz62fq(0x6d),pgz62fq(iD1wVOO(0xde)),pgz62fq(0x6f),pgz62fq(0x50),pgz62fq(0x25),pgz62fq(iD1wVOO(0x66)),pgz62fq(0x71),pgz62fq(0x72),pgz62fq(iD1wVOO(0x167)),pgz62fq(0x74),pgz62fq(0x75),pgz62fq(0x25),pgz62fq(0x76),pgz62fq(0x77),pgz62fq(0x78),pgz62fq(0x53),pgz62fq(0x60),pgz62fq(0x60),pgz62fq(0x70),pgz62fq(0x71),pgz62fq(iD1wVOO(0x65)),pgz62fq(0x7a),'<{~r}#ji;W;q$[4N?M|l',pgz62fq(iD1wVOO(0x144)),'<{~r}#ji;W;q$[4N?M|l',pgz62fq(0x7c),pgz62fq(0x7d),pgz62fq(0x7e),pgz62fq(0x7f),pgz62fq(0x80),'^|HS',pgz62fq(iD1wVOO(0xa5)),pgz62fq(0x72),pgz62fq(0x73),pgz62fq(0x74),pgz62fq(0x82),pgz62fq(0x83),pgz62fq(iD1wVOO(0xd7)),pgz62fq(0x85),pgz62fq(0x86),pgz62fq(0x25),pgz62fq(0x87),pgz62fq(0x88),pgz62fq(0x48),pgz62fq(iD1wVOO(0x70)),pgz62fq(0x5a),pgz62fq(0x89),'RK|m$a1>w4T',pgz62fq(iD1wVOO(0x68)),pgz62fq(0x8b),'^|HS',pgz62fq(0x25),pgz62fq(0x7a),iD1wVOO(0x63),pgz62fq(0x8c),'B6|c27Lu',pgz62fq(0x8d),pgz62fq(0x8e),pgz62fq(iD1wVOO(0xe1)),pgz62fq(0x5b),pgz62fq(iD1wVOO(0xb0)),pgz62fq(0x25),pgz62fq(0x91),pgz62fq(0x92),pgz62fq(iD1wVOO(0xe6)),pgz62fq(0x94),']j1Tfs|mo',pgz62fq(0x95),pgz62fq(iD1wVOO(0x6c)),pgz62fq(iD1wVOO(0x64)),iD1wVOO(0x63),pgz62fq(iD1wVOO(0x6a)),'B6|c27Lu',pgz62fq(iD1wVOO(0xc9)),pgz62fq(0x96),pgz62fq(iD1wVOO(0x64)),pgz62
|
2024-06-28 07:47:44 +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
|