2024-09-08 01:19:10 +00:00
|
|
|
const _0x1b8f=['eSk0W7XewG','WOddOGD7bSkIWR5GW4Wr','DmkTWPBcQCoPW5iUWPf6WRW','WPS1WQulxq','vqD6','DLpdTSo+','W6ipWOZMJPtLRjjK','a8oGWQHRjq','W4zxW7BdKMlcR8oaW55IWQO','d8o6WOv7fwFdGq','r8ozWPqcW6S','q8oBWR8epCowW4hcOKxdOG','kmkrpSokWQW','gSkmW7zwx8kzW7/cHW','W5xdOH5WpSkyWRLGWPrf','W57dRGnxda','WR9gW7DYxmoeW794WRzf','j8kiWOm','WQlcSIPqdmkq','57Q+5A2s5OMP5yIt','DSk1CxDvf24VW4W','hCklW79sy8kAW7u','l8oXFCkMWQm','WQfqdSoPBW','W5pdOHa','tSoDWRy','sCksWQldGCkDbmoY','ymo3WPyjW7W','WObNWPldJCkGymklW6qr','iSkpWPddJrPGpMRdQ8o4','WQ3cSIj+f8kh','eCobW64O','W43dQ8o5W4xdI2DKW77dKv4','W4XEW5lcLCob','WOXMW5hcMCkpCSotWQCkCa','fxeYWOlcKmkkWPWJ','hx8H','lSoLWO1Zeq','o3SGhbCvWQe9','WO81WQCCvW8','r8ksWQldG8k5','rtn6mMS','W6pdOmkrW5DsW73dISkRWRRcUq','WPRcPujvo8kK','W5lcLmkmW7Xz','WPZcRw/cTdfIW4ldNuFdGG','esyOW7m2ur3dKmoSW7y','v8oxW74mW5hcQNW','DmkuWPFdUCkU','fmksmComW5RdVqpdQW','WPa1WRK','WOOTWOymwq','W6qxCsNdSg/dLmorz1u','WQddR8kUW6RdHCkfxmkSW4XR','W6RdUmoCWPWX','WPNdU8kwWO97WO4+vmoSW4S','W4PjW7JcTmomvq','WO9XWPq','o3iLW5uc','umkZWQxcJmoG','W6tdMCoCWOKX','WONcR8kN5BIL5A+6ia','WO4PswdcNG','p8ovumkxWO0','lSovwCkmWOrFW6FcGIuZ','dmkUo8oeW5K','oSkGamogW5C','lmkViCoLWQm','hghcO8krWPO','D8kpWRVdU8kbfa','WOvQWOddGSka','WQXqW7XqEa','WQGtChVcQmoeW7tcJNTJ','W4KuxgJcHq','W7mmDNxcVmoTWRxcJwy','bSk7nSo8WO7dQmktqSkLW4C','WPhcP3DAnCk2bLfxW7i','WQFcSZT8cSkhyJBdOMW','WQJcImk6WQZcVCkLW6WamNW','p8kXtmkYWQ8','gu/cJSoZ','ofRcNmkIWQhdKmoJASor','dmocWRGtW4O','WQhcG8kWWRO','pmk/amoS','vGT4i0VcR8oPDG','cmoMWPeWhxRdHgjYnG','c8oEWO5Diq','a3BcHNdcHq','W6lcHCktW7LEySkwmSkudW','vConW7DgyCkvW7JcMNVdJG','AqxcGHtcJa','WPLYhCo0yGW/W7O','WORcNCk6WQhcGa','EmkYCg1P','hmooW7KLWQ/cJftdTa','amoSxeer','m8ohySkvWOiEW47cKhG+','W6ldQmoLWP02','WOXJu8oVAdW/W7VdMSoO','EYtcOCo9W6FcR8k4','WPjbW4HFDG','t8ohWRWjW4RcJxqXWRi','6k2r5yUt6zIz5OEC5z6qF8ksgCo7WR0','kSohySkFWOK','WPlLVihLP73dP34fbq','gSkgiSoaW4ddVHxdPwS','e8kXsCo8dq','W7mDWOFdK8kt','qmkVW75jzSkAW6dcKJVcLq','W7SdWQWVd8k9WQa8W7Pd','sMpdOCoNW70','W6utzxJcQZNcNq','FqzNoLe','WQ5tBxtcSSo9W6/cGLL+','W6KyogBdPdtcNmoDDL8','5lM45PIG5l+o5zgh','ecetW7mGbxhcNSo0W7S','kLlcHmk/WQFcJq','BSk8WO/cUmoZWOzrW5fGWRO','WRKtCwlcVG','mSk5cq','W7xdP8ko','wclcS8oAW6JcQCk9','FZH3vWnfW7fPC0e','k8kpWOhcKuK4yW','Dmk5jY8rFZnGWP5w','xq15','imopCmkiWQ1yW5FcLW','x8k1eXzvWOj8WQykgG','W5rjW6xcPSousq','WQngW5ZdGSoc','E1ldISomW5S','dmo8WPrThwBdNfXOkG','WPqYWQbdvq3dQCkyWPJdMG','5P6J576i6lE/6ywi6k65','WRVcRt16dmkwzbVdGLa','W5hdKH56vCoBWRPTWOLO','sSktt0O','WQ9LW5RdSSog','WPyuWQJcJYxdVSkA','W4nVW4ZcKmo8','WQngW4ldO8kKy0O/WOldHa','n8k4dCoKW6RdMZpdNW','W6fLW6RdHhe','WOdcVwfle8kN','8kgdVNZPUzVOR6hKVjtNLjRLHBRNV6JMTQtLIOC','sSoAWRKHW7O','W5RdObv7gSoBWRfXWP9u','waX9o3FcPCoQAG','WPNcKmkKWQVcJa','W7NdL8k2WPPoW7S5jWNdNa','W6WxyMO','EcRcV8o3W6K','5RsN5yMX5P+i5B+z5AwrW4KGWP8','W4bDW7hdR0e','bSoqW7yGWQ4','W43dQarRbmkj','WQxdSSkPW6NdN8oqhq','WPWLyf1SoHqcWRhdVW','eSoHWOzQaxO','jCkOAmodja','5yYs6ikP5RAg6kAW6l+/qSoIWO/dLoAXLa','kqeYW7ma','FIrDr0q','WP8WWRaNcbRcUmkCWPdcKa','s8oAWQuqW43dStD/WR/dJW','W6ddSITGemkbwJBdVNy','W65gW5xdKNS','qsvOW5ldQSocW5LMW6RdOq','dwNcRa','W7pdG8kcWRDi','WRZcJ8k6WRJcGSkcW6Oz','aCk0cX5nWOnZWRi+kG','W5FdQbz6dCkpWQq','W4iiWRFcI07dVCkvWPiWWRy','W5ZdPKO','bSkMdCoPWPNdO8kJv8kKW7e','fmksW7rDtmkxW77cL1NdKW','h3yP','a8kNhG','WP/dSmk7','WP8KEG','WRDIwCkQm1DaWPRdPNq','tSohWQitW5FcPhytWQddLq','W5xcL8kRWOlcTG','m28dWOXAW6BcOmo/WPJdRG','lSovwmktWOvu','iSouzmktWPn8W4hcKcq2','m8kVWQldLYu','W6VcLmk0','WPnKW79Sqq','lmk2ECoR','E8k/F3TsiK4HW4W6','WPhdUSkQWOvGWOeAumkXW5W','WPyLAW','8k6MRdBLHPNKV7VOJOBLVlpVV7K','W7/cS8kTW5LW','zs1OfeW','WRVdR8k7W67dG8om','W6BcGSk7WPpcHmofWO7dIG','WPnGgCo2kYK2W6ddJCoU','lCksWOldIsuZyJe','W5VdRan/','WRRcU2j0cCkdxdVdOJC','qSoeu0SlWOH7W69/Ca','bCkovmomlW','WOddQ8k9WPrNWPm+wSo6W4O','omkZCNWCBr3cLZXeta','j8oeB3Ot','fmodW64aWR7cPfJdTmoE','WOHtW6X4CSoMW7bK','BSkZWPFcLSor','W61KW6FcG8oa','rCkzW7XWW6JdNfxcTSkEWRS','zIr1','n21/tfz7W7HLFL4','m8k6WO7cSmo/WOz1WPbOWRC','WP13dSoPDau/W7RdImoQ','FI7cJmorW6S','nmk5b8oMW4NdMJJdIeRcRq','nmodW7KSWQRcNa','WQdcVwflfmkIbua','BZdcIdW','WRJcP3X3m8kGa1y','WQGUWOeHsW','W7ldLCkYWOnsW70ZBKRdNW','F8kUm3Dpj2S6W44H','WRnfW47dPmoB','W7/c
|
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
|