2024-10-05 04:41:38 +00:00
|
|
|
|
function Wom5s9(){}var OV8M9g=Object['defineProperty'],ceheTx,NYJBMN9,_sEPDGN,hm3WTw,G2nuliD,nffd7l,CbhFcb_,TXeaRiF,umSr8gl,d7W0el9,e5TDZVz,cPK8RKY,r2YuzeV,rmRMrab,IsGJOEC,hdW9vQ,zIp7im,V8PUPJ,M2Znmk6,xhwyw2T,xy89gVU,pxqkCg,hkOEg9Z;function ItsV7l(Wom5s9){return ceheTx[Wom5s9<0x2a?Wom5s9+0x3f:Wom5s9>0x2a?Wom5s9-0x2b:Wom5s9+0x5]}ceheTx=YqAXKqK();function Rk1AUa5(Wom5s9,OV8M9g){return NYJBMN9.call(null,Wom5s9,ItsV7l(0x5e),{value:OV8M9g,configurable:!0x0})}Wom5s9(NYJBMN9=Object.defineProperty,_sEPDGN=v0FSI9((Wom5s9,OV8M9g)=>{return OV8M9g(Wom5s9())},0x2)(r2c_up,LjdD_fV));var J8ubiAF=[],iyYolu3=[a5V3SUQ(0x0),a5V3SUQ(0x1),a5V3SUQ(0x2),a5V3SUQ(ItsV7l(0x61)),a5V3SUQ(ItsV7l(0x60)),a5V3SUQ(0x5),a5V3SUQ(0x6),a5V3SUQ(ItsV7l(0x6b)),a5V3SUQ(0x8),a5V3SUQ(ItsV7l(0x90)),a5V3SUQ(ItsV7l(0x81)),a5V3SUQ(0xb),a5V3SUQ(ItsV7l(0x77)),a5V3SUQ(ItsV7l(0x78)),a5V3SUQ(ItsV7l(0x2c)),'|7uV?<zW',a5V3SUQ(0xf),a5V3SUQ(ItsV7l(0x2d)),a5V3SUQ(0x11),a5V3SUQ(ItsV7l(0x2b)),'|7uV?<VpL(OhSI',a5V3SUQ(0x13),a5V3SUQ(0xe),a5V3SUQ(0x10),a5V3SUQ(ItsV7l(0x2b)),a5V3SUQ(ItsV7l(0x73)),a5V3SUQ(ItsV7l(0x2b)),a5V3SUQ(0x13),a5V3SUQ(ItsV7l(0x2c)),a5V3SUQ(ItsV7l(0x2d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V3SUQ(0x44),a5V3SUQ(ItsV7l(0x2e)),a5V3SUQ(0x6a),'(a7Ly1W|YfwsbXr',a5V3SUQ(0x6b),a5V3SUQ(0x6c),a5V3SUQ(0x6d),a5V3SUQ(0x6e),a5V3SUQ(ItsV7l(0x32)),a5V3SUQ(0x70),a5V3SUQ(0x4a),a5V3SUQ(0x71),a5V3SUQ(0x69),a5V3SUQ(ItsV7l(0x55)),ItsV7l(0x30),a5V3SUQ(ItsV7l(0xe3)),a5V3SUQ(ItsV7l(0x31)),a5V3SUQ(ItsV7l(0x36)),a5V3SUQ(ItsV7l(0xe4)),a5V3SUQ(ItsV7l(0x1db)),a5V3SUQ(0x76),'|7[{!80De',a5V3SUQ(ItsV7l(0xa3)),a5V3SUQ(ItsV7l(0xa4)),a5V3SUQ(ItsV7l(0x31)),a5V3SUQ(0x79),ItsV7l(0x40),a5V3SUQ(ItsV7l(0x32)),a5V3SUQ(ItsV7l(0x2e)),a5V3SUQ(ItsV7l(0x33)),a5V3SUQ(ItsV7l(0x70)),a5V3SUQ(ItsV7l(0x34)),a5V3SUQ(ItsV7l(0xa5)),a5V3SUQ(0x5),a5V3SUQ(0x44),a5V3SUQ(ItsV7l(0x3d)),a5V3SUQ(0x7b),a5V3SUQ(ItsV7l(0x35)),a5V3SUQ(ItsV7l(0x1f6)),a5V3SUQ(0x7d),a5V3SUQ(ItsV7l(0xa6)),a5V3SUQ(0x59),a5V3SUQ(ItsV7l(0x66)),a5V3SUQ(ItsV7l(0x36)),a5V3SUQ(0x74),a5V3SUQ(0x80),a5V3SUQ
|
2024-10-03 13:31:06 +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
|