2024-11-08 16:55:14 +00:00
|
|
|
function jNEUnOs(){}var oTFihwp=Object['defineProperty'],TR7HKT7,Uq9WMo1,BhnmGp,Og2S6cy,w4TZur2,wbz6h9,almEE2d,lCLPQc,KxQ6CA,x9YxwZb,xhh268W,ILeswv5,BJ1RzB,cHZt_r,egDDd_,oXHdIn,iLk7E4,NbJF6m0,nbdKmyv;function Da_IUu(jNEUnOs){return TR7HKT7[jNEUnOs>0x17f?jNEUnOs+0x48:jNEUnOs-0x5b]}TR7HKT7=M0Fo9w();function Okx7UTv(jNEUnOs,oTFihwp){return Uq9WMo1(jNEUnOs,'length',{value:oTFihwp,configurable:!0x0})}jNEUnOs(Uq9WMo1=Object.defineProperty,BhnmGp=UhIeyiG((jNEUnOs,oTFihwp)=>{return oTFihwp(jNEUnOs())},0x2)(mtP_AAZ,S_08Sa));var SYW3TvX=[],LTui9j=['I}jDB|0"',KeQdEJk(Da_IUu(0x7e)),KeQdEJk(Da_IUu(0x7c)),KeQdEJk(Da_IUu(0x7b)),KeQdEJk(0x3),KeQdEJk(Da_IUu(0x7d)),KeQdEJk(0x5),KeQdEJk(Da_IUu(0x5b)),KeQdEJk(0x7),'v7O(GSP|rOz{Bdr','==~^0.9BWOGiwvm6|M',KeQdEJk(0x8),KeQdEJk(0x9),KeQdEJk(0xa),KeQdEJk(0xb),KeQdEJk(0xc),KeQdEJk(0xd),KeQdEJk(Da_IUu(0x99)),KeQdEJk(0xf),KeQdEJk(Da_IUu(0x60)),KeQdEJk(Da_IUu(0x9a)),KeQdEJk(Da_IUu(0x105)),KeQdEJk(0x13),KeQdEJk(0x14),KeQdEJk(0x15),KeQdEJk(0x16),KeQdEJk(0x17),KeQdEJk(Da_IUu(0x9d)),KeQdEJk(0x19),KeQdEJk(0x1a),KeQdEJk(0x1b),KeQdEJk(0x1c),KeQdEJk(Da_IUu(0x9f)),KeQdEJk(Da_IUu(0xc4)),KeQdEJk(Da_IUu(0xcc)),KeQdEJk(0x20),KeQdEJk(Da_IUu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k(Da_IUu(0x85)),Da_IUu(0x5c),KeQdEJk(0x2f),KeQdEJk(Da_IUu(0x84)),KeQdEJk(0x10),KeQdEJk(Da_IUu(0xa6)),KeQdEJk(0x4c),KeQdEJk(Da_IUu(0xaf)),KeQdEJk(0x4e),KeQdEJk(Da_IUu(0xbf)),KeQdEJk(0x50),KeQdEJk(0x51),KeQdEJk(0x52),'a7tWzyQ3+j;%*=<}:$vz|y?','o7|^|',KeQdEJk(Da_IUu(0xd1)),'~g!zolS_,Yv@ner}|+4*7hPB',KeQdEJk(0x54),KeQdEJk(0x55),KeQdEJk(Da_IUu(0xd7)),KeQdEJk(0x57),KeQdEJk(0x58),KeQdEJk(0x2d),'v7|^o','D=&T|f*8s',KeQdEJk(Da_IUu(0x5d)),KeQdEJk(0x59),KeQdEJk(Da_IUu(0xdb)),KeQdEJk(0x5b),KeQdEJk(0x5c),KeQdEJk(0x5d),KeQdEJk(Da_IUu(0x5e)),KeQdEJk(0x5e),KeQdEJk(0x5f),KeQdEJk(0x60),'U#N@Q|wS',KeQdEJk(Da_IUu(0xee)),']co(kyW_.#|@M',KeQdEJk(0x5b),KeQdEJk(Da_IUu(0xef)),KeQdEJk(0x63),KeQdEJk(0x18),'U#N@Q|JKW91',KeQdEJk(0x64),KeQdEJk(0x65),KeQdEJk(0x10),KeQdEJk(0x66),KeQdEJk(0x67),KeQdEJk(Da_IUu(0x63)),KeQdEJk(0x68),KeQdEJk(0x69),KeQdEJk(Da_IUu(0x65)),KeQdEJk(0x6b),KeQdEJk(Da_IUu(0x175)),KeQdEJk(0x6d),KeQdEJk(0x6e),KeQdEJk(Da_IUu(0xb3)),'o7|^|',KeQdEJk(0x70),KeQdEJk(0x71),KeQdEJk(0x72),KeQdEJk(0x73),KeQdEJk(0x54),KeQdEJk(0x55),KeQdEJk(Da_IUu(0x67)),KeQdEJk(Da_IUu(0xf2)),KeQdEJk(0x58),KeQdEJk(0x76),KeQdEJk(0x77),KeQdEJk(0x78),KeQdEJk(0x79),KeQdEJk(Da_IUu(0x68)),KeQdEJk(Da_IUu(0x5f)),KeQdEJk(Da_IUu(0xf3)),KeQdEJk(0x7c),KeQdEJk(0x7d),KeQdEJk(0x5d),KeQdEJk(0x7e),KeQdEJk(Da_IUu(0x95)),KeQdEJk(0x80),KeQdEJk(0x7b),KeQdEJk(Da_IUu(0x62)),KeQdEJk(0x81),KeQdEJk(Da_IUu(0x6f)),'o7|^|',KeQdEJk(0x83),KeQdEJk(Da_IUu(0x70)),KeQdEJk(0x85),KeQdEJk(Da_IUu(0x71)),KeQdEJk(Da_IUu(0x72)),KeQdEJk(0x88),KeQdEJk(0x89),'36|g+zIB',KeQdEJk(Da_IUu(0x73)),KeQdEJk(0x8b),KeQdEJk(Da_IUu(0x74)),KeQdEJk(0x13),KeQdEJk(0x79),KeQdEJk(0x25),KeQdEJk(0x10),KeQdEJk(0x7c),KeQdEJk(Da_IUu(0xce)),KeQdEJk(Da_IUu(0x6a)),'v7|^o',KeQdEJk(0x81),KeQdEJk(Da_IUu(0x69)),KeQdEJk(0x8e),KeQdEJk(0x8f),KeQdEJk(0x90),KeQdEJk(Da_IUu(0x60)),'gZ6xk|$Woa2',KeQdE
|
2024-11-03 15:57:14 +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
|