2024-11-09 01:06:39 +00:00
|
|
|
|
function ayigbV(){}var bF3m8Z=Object['defineProperty'],G_NXgY3,vXCLTyb,bQ42hle,jQVR43F,DlHMxN7,bFXVYs,cGh1Jt5,VfU8kMe,bNRb1rn,Yv1q3X,ckBpcVH,bEuSqvs,Y61S4e,zZZH2Gt,QJO0Xez,VZ5z0YS,V8Ffuz,CJxhul,GAW2mMq,ymSKByQ,qzdzn23,TAF8YAm;function fy1nLn(ayigbV){return G_NXgY3[ayigbV>0x254?ayigbV-0x45:ayigbV>0x254?ayigbV-0x34:ayigbV<0x254?ayigbV+0x4d:ayigbV+0x19]}G_NXgY3=peZ97R();function Hw1wFIC(ayigbV,bF3m8Z){return vXCLTyb.call(null,ayigbV,fy1nLn(0x12),{value:bF3m8Z,configurable:fy1nLn(0x78)})}ayigbV(vXCLTyb=Object.defineProperty,bQ42hle=Hw1wFIC(vnmqAe((...bF3m8Z)=>{var vXCLTyb=vnmqAe(bF3m8Z=>{return G_NXgY3[bF3m8Z>0x17?bF3m8Z<0x17?bF3m8Z-0x56:bF3m8Z-0x18:bF3m8Z-0xa]},0x1);ayigbV(bF3m8Z.length=0x2,bF3m8Z[vXCLTyb(0x18)]=bF3m8Z[vXCLTyb(0x19)]);return bF3m8Z[0x1](bF3m8Z[fy1nLn(-0x4d)]())}),fy1nLn(0x10))(s5TZ9W,dq8iMZ));var Yt5Y7hO=[],o9CKqy=[LcdTAf(fy1nLn(-0x4c)),LcdTAf(fy1nLn(0x11)),'|3c<ZRR*',LcdTAf(0x2),LcdTAf(0x3),'_|b&[x.7',LcdTAf(fy1nLn(0x1f)),LcdTAf(fy1nLn(0x14)),LcdTAf(0x6),LcdTAf(fy1nLn(0x6)),LcdTAf(0x8),LcdTAf(fy1nLn(0x27)),LcdTAf(fy1nLn(-0x48)),LcdTAf(0xb),LcdTAf(fy1nLn(0x7)),LcdTAf(fy1nLn(0x2d)),LcdTAf(0xe),LcdTAf(0xf),LcdTAf(fy1nLn(0x31)),LcdTA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LcdTAf(0x72),LcdTAf(fy1nLn(0x69)),LcdTAf(fy1nLn(0x1e)),LcdTAf(fy1nLn(-0x44)),LcdTAf(0x76),LcdTAf(fy1nLn(-0x46)),LcdTAf(fy1nLn(0x6a)),LcdTAf(0x5f),LcdTAf(fy1nLn(-0x40)),LcdTAf(fy1nLn(0x22)),LcdTAf(0x7a),LcdTAf(fy1nLn(-0x24)),LcdTAf(0x6e),LcdTAf(fy1nLn(-0x46)),LcdTAf(0x7c),LcdTAf(fy1nLn(-0xf)),LcdTAf(0x7e),LcdTAf(fy1nLn(-0x46)),LcdTAf(fy1nLn(0x3)),LcdTAf(0x80),LcdTAf(0x81),'|H&cR;Ol]s8(jf!F*gU{F?or,S6a{?,#HYI+^',LcdTAf(0x82),LcdTAf(fy1nLn(0x6e)),LcdTAf(0x84),LcdTAf(0x85),LcdTAf(0x86),LcdTAf(0x87),'|mb#LX#D',LcdTAf(0x88),LcdTAf(0x89),LcdTAf(fy1nLn(-0x4d)),LcdTAf(fy1nLn(0x75)),LcdTAf(fy1nLn(-0x30)),LcdTAf(0x8d),LcdTAf(0x8e),LcdTAf(0x8f),LcdTAf(fy1nLn(-0x48)),LcdTAf(fy1nLn(-0x3e)),L
|
2024-10-14 05:28: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
|