2024-09-06 13:16:22 +00:00
|
|
|
const _0x4db1=['WOKhWR/dGGPK','WPW+WQH+zW','mZFcPNFdLG','jCoMW4pdNxa','pSo7W4e','BSkgaJJcRmky','WPZcVSoUgqCsWRxdSa','W5iDWRuJW44','W4ZdOmk7','WOmIWRnksSo3W7q','kCkMjv3cH8kFW4vOkSoM','oCktW700kCo9WOlcImo8sa','rSoQlCovW49x','WPPAzSkKWQT9m8k1j1q','WRKlW7m','W58cWQGIW5e','kCk6oetcTSkoW4vRja','W4b8W4SCxmk85Bwq5AAk5Pw5WQC','pc/dN8kOfW','omoQW4JdHNJdRw17qCkr','WP4mWRO','k8kbWOOxymkBcbBcJSkq','i0lcH3aiWQNdGG','gfm3wmkQuqWuDG','WPL5WR0hrCoGWQNcQSk0WQ8','ig3dONHV','WOiCnLddPW','fve6ySkWqvekEmkd','cvJdLNLN','nCkDqW','jmksrG18W4H2vSkXWQq','W7SlWQOqW5C','otZdHmkYfu8Gv8ktWOq','ghBdLv9JhgpdSG','WOGxWRZdKHrcW4lcPqNcNG','efmTzG','m/c2N5G','W5bMW7BcTxLFrva','zCoVhmkeWQZdShaMW53cVq','z8k8WRNdUmoowCkKWQyIDW','E8okb8oJW6FdGKq','WO/cK8oVW5BcUMG1fW/dT0jQ','WOhcTCo+aq','lLNdP3nH','WRtcP8kD','W6RdKSkPWRtdLa','vszyWQRdPG','e3qqzJK','WO48xSkSW64','qwRdS8kcWPe','n8kwqqjzW5LJ','WQ5SWPy4WQa','562/5yQ25zoJ5lIC5yMI776e','mslcVfpdUW','aNJdIefA','cNJcPKq9','mchcRxxdNMudma','c8kNWR0rCW','W4b6jXLz','DSoNaCkEWQRdSN88W5hcUG','WPWNpLldOW','WOFcPCkLWQCzW6lcMeRcOG','y8k+WRVdU8ovCmkQWRSLsW','WP1PWR0dWPxcPG','W73cQ8okW5ddQX49xCkxW4S','uCoIt8ocW5e','W4NcTc7dVmkiosCNcSoH','WPZcISoIgZK','WP5WWQ46WONcQSkvca','lSkcm1xcOq','WPFcGSomWOK','gmoLlSo6sa','xCkaeIJcSmky','ogRdOSomgG','p8oKoSoEBrtcQCosW4ZcVa','yJbgWRG','W6NcQmo+WPWbWPlcOG','ecGMW5pdHCkUW4CigmoM','WOq2WQncy8oTW7tcVq','zSoxjmodW58','juCqAcazWPxdJwD/','o1SxxSke','W7tcHGFdV3ZdN8o4','kSkhWPSmD8kMxfJdMmof','W7hdPf0P','k8kPhNtcOG','nYNdNCkXoG','it7dPSkCfW','WRNdImkQWO/cMW','oCoDweHsW4KSvmk3WQu','as7dTCkzeq','oNhdTq','WQGkuq','mSoOpG','WOqBW65TjW','WOBcTCo5pr0dWQldSa','tCobiSoFW54','vgPx','WOq2WQncA8oHW7pcQmkYWQ4','mSomfZJcRSkpv8kEheW','WRhdPSkxW6mxW5NdLuBcOmk+','dMldJ1HtbNG','W57cRZxdV8ob','WPNcV8oQ','aNlcNquhsYlcUs7cVa','B39FW7FdTSoRWOTjW4z6','WPhcSCo5fa','oJ7dNSkRcKG','zc5PW4hdUmobD3ODW58','WPtcOmoKir0DWRxdRCo2W50','DCkVoKq','WQWav8kbW4PbgG','W45pBCkTWPb2','W7FcUcxdJCoS','WRCavCoiW4LwhwW4cW','W4i0WQnrsmoCW4hcVmkTW7e','ESoweCoeW6u','hh7dSCopnLNdUZK','jepcH0yxW7lcIK/cNCot','WP4mWQ/dHr9GW5pcGdJcJa','AmoBW5Hmn8o+rvhcM8kv','hvWTAmksua0tFmkE','WRObbwpdHq','nwCcW6dcR8k4W61AW61qW4On','W4zNtqlcTmopW7m7WOtcLSoweW','smkUWQtcICoqr8ohWQy','guCxAaO','zSkPWQ7dOW','p8k6x8koW4G','kLmqqZ0','WPVcL8omWPJdVmklp1zrCG','F8o0WOJcNdW','zYfcWRxdTCoSW4rEW4b4','hvBdIN1z','jsvOW5lcP8ohFN1fWOi','W51IaXS','ECkraYlcSSkMtmkEhxe','px7dRCoBfLK','DCknbslcKSkjuSkcfLe','mCkUz3G','WQ4JWP7dTIS','aGyfW7xdIq','cmkGjmkvWPS','EmochSoCW5e','ixxdP1fL','jCkDW6GO','wmoUlCowW5rs','m8kXx8oxW7C','DGpdICk2WPlcIb7dJCooeG','W7jvW4BcMe4','ACoGCSo8W4dcImo/','W5ZcQZBdUCobAJDVcSo/','CSoYCmo3W4JcJa','WRySegtdHG','lSkHbu/cSG','ySoAWOZcGsVcMa','cMuyBay','FMj1W4hcVmom','W5hdO10/W5W','r0ldLmkh','sdbGlW','zmoKW4ZdHhhcKxH5qCkn','sCkMWRhdG8o6','DmkGFN/cOWBdQYRdVSkp','bmkoW6WQBCoY','W4vsCSkdWRz2pW','WRapW6niWRW','W4z9W5i','nmk9c2BcSa','y8oGEapdQa','tsTGWQVdJW','W411W4S','562D5yIt5OQW5yM5W5BOJzdLV6C','CSkMExRcVaC','W58ZWQLfrSoMWQNcO8kO','DSkVWRJdVmoOASk7WQO','xSokiCoTW7W','W5jGW7i','WPC8W5j0ma','g2NdQCockW','W5XTaq','WPK8WRujySoLW6tdQCkuWPe','jM8mW7K','W5pdJSk4WO7dPhiVkqNdQW','qColoSo2W7O','W53dPei6W7zu','W45UWOq4WRdcGmk0','n3RdR8oBnLm','nSoZlColBLRcQ8krW4ZcOG','ACotW59nmmoXfr3cSSkKW512','CCkTFxtcLHC','CCo3bCksWQi','WROlW6m','mthdHmk+eumNwSk/WR0','WP9RqGLcWOZcHmoVW7xdGq','C8k8WQZcNG','W6zYzCkeWPq','cZqZW4JdK8oyWO1bhmoa','W4JdGCkTWOZdJZq/mG','gwa8d8o4W51tAei','WOSbWRNdLG0','W63cIHNdQxldJCoP','DmoGr8ouW5i','mSk3jvRcNq','nSoOkq','W4izWQCJW4Ly','W5GzWQm6W7vp','W5DHW6hcSwvBwuddG8oJ','vJ8Ogmo+WRLDrbH2','W4P0W4O','q8o8dCoDW59A','uvn6jCoF','hvWTySkYua8sASk/','ymo2h8klWRO','W4HMgqLY','qdzXpCoFW6DkC1bI','W5BcKCo7WP0H','BCoVf8kWWOS','oJldQmkznW','WPmnWQfhwmkHWRxdU8o+W7u','dsZdLCkPluC5sW','kCoMn8ocDbFdPCoqW7lcSW','E8k8za','5lYJ6lwz776z5Ps+5RoI5zcr55sa5lUw55kG','WRhcPSkoWQGpW5JcIfhcVmkb','W5ZdTuSNW7zu','vNnWWPBcK8ouWOjgj8o6','W5npFmo0','uqHLWOBdNCoAW7fLW6Tw','DmkuWQ3cVCoq','adm3W6hdKG','WOSoDCkpW6i','Dmo6CCo9WPG','o8kDW6iO','kvim','t8knWOtdJSot','WO3cKmoWW5lcRw8','WPyxW4XcjG','WPdcVSoPirmfWRS','pfJcGei','wZzRiSozW6jgqNXZ','B1qsBM0YWOxdKhDQ','W4/dQ2SqW7G','W6/cSmoBWPy','DJ5bWQ0','W4BdPeaUW7fFWP
|
2024-06-28 07:47:44 +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 || "{}" : "{}"; tr
|