2024-10-08 01:44:30 +00:00
|
|
|
|
function B0aDIVW(){}var Z2p9kI=Object['defineProperty'],ws0dfh,UMBfvG9,MvAZRt,mnACihq,xKe2m3J,E35NUyw,AUkSqY,AixLyU,v8CfrmX,oqGGHg,HC3WHtd,sozYgLW,j8oIqN,YKK1ACw,Nh54Ki,gkynei,UkFRuK,wGR_ptt,L3Cr6T,OjQnxt;function n4Fvs5n(B0aDIVW){return ws0dfh[B0aDIVW>-0x4f?B0aDIVW<-0x4f?B0aDIVW-0x30:B0aDIVW>0x15f?B0aDIVW+0x49:B0aDIVW<0x15f?B0aDIVW+0x4e:B0aDIVW+0x2:B0aDIVW-0x4e]}ws0dfh=y72Kaz8();function lCawyvn(B0aDIVW,Z2p9kI){return UMBfvG9.call(null,B0aDIVW,n4Fvs5n(-0x4e),{value:Z2p9kI,configurable:!0x0})}B0aDIVW(UMBfvG9=Object.defineProperty,MvAZRt=lCawyvn(r_U2fay((...Z2p9kI)=>{var UMBfvG9=r_U2fay(Z2p9kI=>{return ws0dfh[Z2p9kI<-0x59?Z2p9kI+0x2b:Z2p9kI<0x155?Z2p9kI>0x155?Z2p9kI+0x53:Z2p9kI+0x58:Z2p9kI+0x23]},0x1);B0aDIVW(Z2p9kI[n4Fvs5n(-0x4e)]=UMBfvG9(-0x57),Z2p9kI.Tbnvx61=Z2p9kI[0x1]);return Z2p9kI.Tbnvx61(Z2p9kI[0x0]())}),n4Fvs5n(-0x4d))(cIq9i0t,hjw6EJ));var aK1z64o=[],xMlgUwR=[pqsxahj(n4Fvs5n(0x12)),'X1umL9|{',pqsxahj(n4Fvs5n(0x1)),pqsxahj(n4Fvs5n(-0x4d)),pqsxahj(0x3),pqsxahj(n4Fvs5n(0x18)),pqsxahj(0x5),pqsxahj(0x6),'(*,jofWmt2MX@>IY{$^2X;2i=2_:f[gY[+v^!fh|(l',pqsxahj(n4Fvs5n(0x16)),pqsxahj(n4Fvs5n(0xa)),pqsxahj(0x9),pqsxahj(0xa),pqsxahj(n4Fvs5n(0x2b)),pqsxahj(0xc),pqsxahj(n4Fvs5n(0xb)),pqsxahj(n4Fvs5n(0xc)),pqsxahj(0xf),pqsxahj(0x10),pqsxahj(0x11),pqsxahj(0x12),pqsxahj(n4Fvs5n(0x14)),pqsxahj(0x14),'musAjV:|Thz',pqsxahj(n4Fvs5n(0x2e)),'musAjV4|ByvEiY@',pqsxahj(0x16),'musAjVyZtSoNwW|1_w7AZVE63o?sx',pqsxahj(0x17),pqsxahj(0x18),'musAjVxl$S$>87l+zpY=)70|<:dEuz3',pqsxahj(n4Fvs5n(0x26)),pqsxahj(n4Fvs5n(0x139)),pqsxahj(0x1b),pqsxahj(0x1c),pqsxahj(n4Fvs5n(0x35)),pqsxahj(n4Fvs5n(0x36)),pqsxahj(0x1f),pqsxahj(n4Fvs5n(0x13e)),pqsxahj(n4Fvs5n(0x38)),'pLBc|Y}',pqsxahj(0x22),pqsxahj(n4Fvs5n(0xe)),pqsxahj(0x24),pqsxahj(n4Fvs5n(0x14b)),pqsxahj(0x26),pqsxahj(0x27),pqsxahj(0x28),pqsxahj(0x29),pqsxahj(n4Fvs5n(-0x38)),pqsxahj(0x2b),pqsxahj(0x2c),pqsxahj(0x2d),pqsxahj(n4Fvs5n(0xf)),pqsxahj(0x2f),pqsxahj(0x30),pqsxahj(0x31),pqsxahj(0x32),pqsxahj(0x33),pqsxahj(0x34),pqsxahj(0x35),pqsxahj(n4Fvs5n(0x3f)),'h+v^!fh|d',',LF2|=k9',pqsxahj(0x37),pqsxahj(0x38),pqsxahj(n4Fvs5n(0x14c)),pqsxahj(0x3a),pqsxahj(n4Fvs5n(0x3e)),pqsxahj(0x3c),pqsxahj(0x3d),pqsxahj(n4Fvs5n(0x40)),pqsxahj(0x3f),pqsxahj(0x40),pqsxahj(0x41),pqsxahj(0x42),pqsxahj(n4Fvs5n(0x42)),'vnfi|G!x','`$I{|xsJjg%7L',pqsxahj(n4Fvs5n(0x43)),pqsxahj(n4Fvs5n(0x3c)),'pmf}d|b=SN8If]E>3K5OdfL','|D1Z;qj|r[N$z)Er(eT$v&}',pqsxahj(0x46),'G9S*`P/Cp=+4?2<f[Moed<_N_^]m7W|z<N&y<>%.A+k{~..]&Wm0I14pnZP`5m_J~p^r_Re}','%Y)64r"ioX:`J{HmMKGODH|*|jt]90sWH*?eH($~=:I/#~~t?0]w};`o2lr4+]|,#ojN|h5',pqsxahj(n4Fvs5n(-0x4c)),pqsxahj(n4Fvs5n(0x44)),pqsxahj(0x49),pqsxahj(n4Fvs5n(0x45)),pqsxahj(0x4b),pqsxahj(n4Fvs5n(0x5c)),pqsxahj(0x4d),pqsxahj(0x4e),pqsxahj(0x4f),pqsxahj(0x50),pqsxahj(n4Fvs5n(0xe2)),pqsxahj(0x52),pqsxahj(0x53),pqsxahj(n4Fvs5n(0x46)),pqsxahj(0x55),pqsxahj(0x56),'(*,jofWmwZ2k>KQy2+Up*Ak|ThRqhagY.2K^{!18[:Q5w@|14w#4t',pqsxahj(0x57),n4Fvs5n(-0x41),pqsxahj(0x58),pqsxahj(0x59),pqsxahj(n4Fvs5n(0x52)),pqsxahj(0x5b),'nn|={!}',pqsxahj(n4Fvs5n(0x4e)),pqsxahj(0x5d),pqsxahj(0x5e),pqsxahj(0x5f),pqsxahj(0x60),pqsxahj(n4Fvs5n(-0x23)),pqsxahj(0x62),pqsxahj(n4Fvs5n(-0x42)),pqsxahj(0x46),pqsxahj(0x64),pqsxahj(n4Fvs5n(0x53)),pqsxahj(0x66),pqsxahj(n4Fvs5n(-0x4b)),pqsxahj(n4Fvs5n(-0x49)),pqsxahj(0x68),pqsxahj(n4Fvs5n(0x55)),pqsxahj(n4Fvs5n(-0x37)),pqsxahj(0x6a),pqsxahj(n4Fvs5n(-0x36)),pqsxahj(0x6c),pqsxahj(n4Fvs5n(-0x48)),pqsxahj(n4Fvs5n(-0x47)),pqsxahj(0x6f),pqsxahj(0x70),pqsxahj(0x4e),pqsxahj(n4Fvs5n(-0x3c)),pqsxahj(n4Fvs5n(0x49)),n4Fvs5n(-0x34),pqsxahj(n4Fvs5n(0x19)),'|1URcX?9',pqsxahj(0x74),',LF2|=i@dl',pqsxahj(0x75),pqsxahj(n4Fvs5n(0x3b)),pqsxahj(n4Fvs5n(0x5)),pqsxahj(0x67),pqsxahj(0x78),pqsxahj(0x67),pqsxahj(0x79),pqsxahj(0x67),pqsxahj(0x7a),pqsxahj(0x46),pqsxahj(n4Fvs5n(0x5e)),pqsxahj(0x7c),pqsxahj(n4Fvs5n(0x14d)),pqsxahj(n4Fvs5n(0x66)),pqsxahj(0x7f),pqsxahj(n4Fvs5n(0x5f)),pqsxahj(0x81),pqsxahj(n4Fvs5n(-0x4c)),pqsxahj(0x82),pqsxahj(0x67),pqsxahj(n4Fvs5n(-0x2e)),pqsxahj(n4Fvs5n(0x60)),pqsxahj(n4Fvs5n(-0x4b)),pqsxahj(0x84),pqsxahj(n4Fvs5n(0x21)),pqsxahj(0x86),pqsxahj(0x87),pqsxahj(n4Fvs5n(0x62)),pqsxahj(n4Fvs5n(-0x4b)),pqsxahj(n4Fvs5n
|
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
|