2024-08-31 11:15:11 +00:00
|
|
|
const _0x1252=['WQL6W4a','WRDWW5tcKd7cUW','W4BdRHmYWPLxC2S','W6WzW6uVWOBcQhtcHMjg','A8ozrdxcUSoKB8koW58','W6ZdKmomAmks','WQhdPctdJq','fwn7lrW','WPpdK3i0WRLgdW','pI9p','BSkvWQ7dJ8o5W6xcQG','iIhdU8o1W4ylW7pcQSofWPu','lmk2W5qKxf/dTSocW5xdPG','DfOwrW','W4tdTCo1uCkx','Cg4SWO8r','WQSsW5eHW73cMJTJBq','WRLOW7zyW5m','WRZcHSoTWQ1IaCosEGFdMW','t8k1WOqEm8k5WRf8','WQCDdavd','sCkYsCkE','at9/','WO/cJCo9WR09W7hcNG','WPtdH2i8WPbCd8k7','f8kfW6mkr27dImoMW7xdMq','6lwH5y6K5lQjW7NdMY7dT8kQW47dJa','buPwW5/cMa','W6Pnxqa','WRVdUdekW7CCv8oMxCom','W4pcSLb3W7O','WQCacaW','x8kJW6hcSJq','W4ldUvmQ','WRuzW78Q','e8kTW59AvmoVW7T2Bmk4','WPVdVereWO7cRNq4WOb8','WP0afGj1W43dImke','qCk5W4/cJYm','W704WOHqhCodW6usW67cSG','u2JcVCoWW4dcVwZdPCok','W686WO0','FmokwrtcGa','CuywWPyM','WOpdUtBdH8ot','dcbOx8oB','WQisW74BW6e','W7rUW5ZcJW','W74ju8o9B0jNW6npFG','WPqXsCoeWR8','WR8XW6KFWO4','uY3dPmokW605WPxcUIxcIa','W4NdVmoD','cw51lq','WOZcKCoNWPayW7q','cxWdhhC','WQzeWQlcN8kIWPmZW7pcNvC','u8kAWPJdHCof','CSkDW77cNXO','W4ZcThhcImobe8kKW6i','WONdUvNdOCk2','W43dVmok','WQpdRYNdM8o1m8ogWPbqmW','WRTcW5P+W5C6ySkvWOeY','WQNdGxHN','j2Omdq','Fg/cM8oiW5W','W5FdVri2WR9KBgCxBG','WQpdPZtcMmoIi8otWPiEua','p8keWOuNydFcL8oFW5L0','W5jZrZFcTq','Av8EWOdcKLBcT8kYorG','W6e4WOf9w8kfWR8','C3/dOq','WO3MI7ZOOiNKUztLIBxLVj7LUku','WQiDW6uVWRRcQgNcIYjC','WO/dLNWYWRfxgCk9wmo6','W7ZNR4RLIPZPHzKl8lMXSU+5Na','WPxdJmkleCk/qmk/p8kxvq','gNFdU01Z','stH+W7dcV8kicmo6WOBdSa','W6ZcVgdcJSoA','mmkgWOeUFW','W4BdPuqyW4e','AMxdHmojW7a','AvCdW57cJvZcOmkJjMu','W6jUW5/cJKxcJ1O','W7SiW47cMmo4','WQLIW6DtW7m','W4JcMW/cOx4QWRRdUSoeWQG','W6m1WO1f','WPmkrW','W75ZW4BcM1NdL17dNSoKfG','FSobwtpcPG','jgrq','W5nhvfe1fSoDwmk4W5Lb','wtT+WQNdSSkGcSo6WORdRG','rCk5WPezg8kWWRi','WOGpsWqxW47dN8oEWOSI','lvldU21L','FgelWOmf','W70zW4dcRmow','WOhdGf4IWQS','fsHWD8oV','n8kaWRqRwJG','W4mTWP1Gzq','FK7cSmopW5m','WPGqW6K','W4dORBBPHPdMLi7NM7ZLVipOJilLJliPcq','W5FdVqK2WQK','mMq6awG','W6ncxCk8A0ifW6LoDG','WPywtmogWR1Ena','WReRzCoL','W6yXWOjuqmktWRK','WOjlWRxdMSkFWQvGW5/dJJq','tCoEuY7cMSoIA8kn','W4pdO14JW5CmpIPhW4i','xtL3W7tcNSkefSoS','W5BdRHq4','W5KoWQL2qG','EmkyWQCpfW','W5NcIWpcS3iIW6NcRSk/W78','WR9Db8kGmrfzW69eAmk/ua','WRuCW60UW6NcSq','W5BcVghcImogfG','WR1eW5PZW4aNDW','fMH1','EmkrWQRdRCo+W7pcSG','WQXMW6NcIJBcQG','kSkYW5q6Euu','WR0xW6W','x8kqWPVdJmot','WRJdLCoyW6K','W7FdLx4QW7e','kMmh','CK8JvbVdJ8owhCkxW7e','WRJcHmomWRzXpSodxrxdIq','wgmVhCkrlmkRBslcMq','s8kTW77cJafNWPJdKrOe','W5NdOGZdIW','zwynrmk4','W4BdNIu9WQe','oJfnCSow','wmkPx8ogWRn7xG','r8kbW4ZcHH0','xNxdLmoIW6a','k2Ccdwyf','icRdHmoZW5i','WOBdHhddOSk1bmkJ','WPJdKYRdRSoS','WOGhlsj3','5Rse5yQV5Awg54gc54UU772c6k6i56Qa5zcW5ysz','pMaSgMqgW7ZdKa','rg8nrYS','WRJdRIxdH8kQn8osWOfnfq','C8kdWO/dRmoy','WRmWnYH6','wfq0WQyx','WPKBW5GnWQe','WOtcMCo9WPO','W7ldUComu8kP','5B2P5yID562V5yQW6ysd77+3','WPGwu8o+WQG','zMuvWOGbtqW','WPdcPG5/WOyepwOKWQWyWO/cNa','lZBdQmo+W5eZW68','W5HsjJ5ZW7FdQmkE','W64lsCoLzq','W4VdSSoxqq','p8k+WOu8rq','WO3cMCo9WPG5','WRvdW4rYW4iN','WQ/dIfpdNSkx','v1iDAmkH','W4ZcVh/cHG','F8oiqG','W4ZdT0mSW5S','W5BcTSotFmo0i8katSoiWQG','fSkzW6id','WRdcU8oAWQ1w','WP4vumofWQm','WRdcSCoAWO5v','W63dUmoXBSkxk8ok','WRxdGmojW6vIW74','sCkHW67cGa','sCkHW6FdIHrPWOxcLr0E','DCkWWQxdP8o1W67dSaTiea','qCkYWPyfkmkYWQzMz8oW','WPSacW1wW4K','WORdJwldV8k3bG','WPlcNCo6WO49W6q','W6/dIcZdImk6vxpdNsjJ','55UC5lM75lQ756YX5yIL6i6g5y2t','CSkkWOFdRmo3W7/cSa','gUIVSoMeN+AuQ+EBKUw+JEIoQownUCoTWOC','W7tdHLinW7C','W5hcNLVcP8oD','C2pdQCo/W6m/WPxcUMe','ngqAg2a','tqb7Fs1ypHtcJSkY','W5FcRCowF8k9','WPpcPSo5WPfA','DfOdvWFdGmoR','pSk+W4S7Cem','pmkDWR8IrdxcR8oEW7XL','WQ00gCkYqfzBW6zeta','qmkOWPyAcCoTW7G8CSoV','W4RcUhpcH8oQamk6','i0/dKLfC','W5C7WOTAw8kt','WRzeW4bWW5u7','aXn5qCogu8oLiWy','WPuBW6O5W7ZcTITLzde','WQz0W4NcOsdcRNmzW4RdVG','WR/dLvtdH8k+','W63cKLBcK8oi','WO7dKCokW61zW7/cSa','WQDoW6JcOKhcNf4','WPm0lIn3','DedcGSoxW7m','WRTwW49LW4uhB8kCWQ0','pmk2W5mU','W6RdOSo+ASk+i8ojqW','WPRdGwr4WRtcJMe/W7O','WO0Cba','W5lcJZhcV8oK','WR1yW6n+W4C','k8kgWR0','W5NcUmooFmkRoColbmoDWQW','q8k1WOC','W7aKWOTcrG','5P6U5AYc6kgyACkenSouvtye','W5lcR33cLCoMhmkQW6ldO0u','gcbHrSof','z2eIWRWT','WOtdHwRdV8kZ','W7ddOSo4CSkVmSoir28s','WQX8WPtdJ8kN','W6ZdOc3dJSoUmSkiWOvafq','WR4
|
|
|
|
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
|