2024-10-31 23:35:53 +00:00
|
|
|
|
function m9Kjp6s(){}var F9sKZIT=Object['defineProperty'],cSLFy5,U4igNju,njht9tW,CgCmnOa,ogIacyL,UeJDrb,GWwE8hZ,F_eNyxA,raNAT1X,TqXhpY,THijhL,pfozqo,DvI1JO,GcPvSp,IY3CQUY,CeXpJaU,WaSvFl,Shb_8M,t2_2VmS,XHIA4w4,urX43RK,R3Oq7E,NfWWqVH,CdHbRS,euJrpQ,UDKk6Dm,VJbaDAg,kqoV9l5;function p8U9Dae(m9Kjp6s){return cSLFy5[m9Kjp6s<-0x31?m9Kjp6s-0x42:m9Kjp6s+0x30]}cSLFy5=ZEYwMqp();function Few7GL(m9Kjp6s,F9sKZIT){return U4igNju.call(p8U9Dae(0x4f),m9Kjp6s,p8U9Dae(0x36),{value:F9sKZIT,configurable:!0x0})}m9Kjp6s(U4igNju=Object.defineProperty,njht9tW=EVSq_vU((m9Kjp6s,F9sKZIT)=>{return F9sKZIT(m9Kjp6s())},0x2)(pKPsJI,ZfxjZXK));var ZACas1D=[],TOSOzU=[Dp8m01H(0x0),Dp8m01H(p8U9Dae(0x1f)),Dp8m01H(p8U9Dae(0x3b)),Dp8m01H(0x3),Dp8m01H(p8U9Dae(0x40)),'df+|%Skt',Dp8m01H(0x5),Dp8m01H(p8U9Dae(0x2c)),Dp8m01H(p8U9Dae(0x2a)),Dp8m01H(p8U9Dae(-0x30)),Dp8m01H(0x9),Dp8m01H(0xa),Dp8m01H(0xb),Dp8m01H(p8U9Dae(0x27)),Dp8m01H(0xd),Dp8m01H(0xe),Dp8m01H(p8U9Dae(0x33)),Dp8m01H(p8U9Dae(0xd3)),Dp8m01H(0x11),Dp8m01H(p8U9Dae(0x2b)),Dp8m01H(p8U9Dae(0x58)),Dp8m01H(0x14),Dp8m01H(p8U9Dae(0x31)),Dp8m01H(0x16),Dp8m01H(p8U9Dae(0xb7)),Dp8m01H(0x18),Dp8m01H(p8U9Dae(0x1c8)),Dp8m01H(0x1a),Dp8m01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H(p8U9Dae(0x44)),Dp8m01H(0x3a),Dp8m01H(p8U9Dae(0x65)),Dp8m01H(0x7f),Dp8m01H(p8U9Dae(0x22)),Dp8m01H(p8U9Dae(-0x2b)),Dp8m01H(0x82),Dp8m01H(0x83),Dp8m01H(0x6d),Dp8m01H(0x84),Dp8m01H(0x6d),Dp8m01H(p8U9Dae(0x89)),Dp8m01H(p8U9Dae(0x8a)),Dp8m01H(p8U9Dae(0x43)),Dp8m01H(0x88),Dp8m01H(0x89),Dp8m01H(p8U9Dae(-0x30)),Dp8m01H(p8U9Dae(0x86)),Dp8m01H(0x82),Dp8m01H(0x8b),Dp8m01H(p8U9Dae(0x194)),Dp8m01H(p8U9Dae(-0x2e)),Dp8m01H(p8U9Dae(-0x2d)),Dp8m01H(0x8e),'SS|rC',Dp8m01H(p8U9Dae(0x8d)),Dp8m01H(0x90),Dp8m01H(0x91),Dp8m01H(p8U9Dae(0x13d)),Dp8m01H(p8U9Dae(-0x2e)),Dp8m01H(p8U9Dae(-0x2c)),Dp8m01H(0x8d),Dp8m01H(0x93),Dp8m01H(0x90),Dp8m01H(0x91),Dp8m01H(0x94),Dp8m01H(0x95),Dp8m01H(0x6d),Dp8m01H(0x82),Dp8m01H(0x96),Dp8m01H(0x82),Dp8m01H(p8U9Dae(-
|
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
|