2024-09-06 13:16:22 +00:00
|
|
|
const _0x256a=['hcK5W6a','lCkVW6JcR8kxA2ZcUSou','lXldPSoXW7PEWRG','WRmlwaSjW6yGsCkoW7m','dSkLpHxcVG','WO/dGmkDumoJWPW','g1CMWOFdHNnMfCodWRq','bSkRW4S','lSoChdzZW49Mye0','WPawvWG2','zSkdlcpcTM14','dSoGW5lcJmkMBmoYWOJcNLK','g8k8W57cJCkh','opcXN6q','WOfKWPxdNCk4WPtcJfe','W78Ai8omsCkNiCkKk3i','vJpcNmkRjG','t8kQWQfsW5RcN1m','mmoudZTz','uHdcKCk9','lxJdHZ4','C8oyvtjvWO5KFuq3','WPRcJbOEeYvFvJfh','W77dI8ktrSoB','WPZdMmk9CKu','WR7cOvrHw8kmWOS','WPLo5As65lMvy+wkHEwiTa','kwZdMdCbW7O','lCoAfdrZW4f0D2b8','mmkheHtcTW','qCk5BSktW41ebMWczq','ibGyW6hcJW','yJOZW5Da','WRWcta','Dq3cSGRdHGy','Deu7W7xdQXNcImkZeai','kNSEFt3dIN7cLq','WRZdHCknxMhdV2G','W7JdQCo5pSojW5FcJ0RcHLO','sSoRbmoBW4G','56wL5AE/W43XH52y','Fxr2WR/cHG0e','W7fBWRpdHSk0WQBdPmoLWPO4','dHDTaJ8','bmkGW5VdTSkTE8k3','WPhcI1zRfW','WQn8WPVdHmk1','W7xdR8o/iCoiWQddHrBcL14','WR/cKColxMq','zadcGItdHW','W7DlWRldNCkqWRm','cJtdTSo4W5C','CHCxW41W','gIuNW7dcK8o5','iSkHW5ddICkLBCkwWQ8','nCkEW5fvW5xcOd/cOmolqq','lHrgja0','yIWSW4bxW44iyc3cNq','W6eiaCoAr8k5lG','qSoBbfykrfus','mCkqWQmkoq','WQbIWPtdKSkgWPJcSN3cISow','W6iyAX7cNCoKg8k6W6yg','Ct8bnCoaW6btWRS','bmk8W43dR8k/BW','pmkGnZtcUq','pgZdHd46W4ZdM8o8xmkw','umo6W49fW5G','WRFdHCkxxxtdOW','WRNcVLzTxG','W7xcRKJcTKG','y8kdpJtcSNHU','vxKSvtaVfSkyaG','WRbUWONdG8k9WOu','WRhcOfjbsmkkWPddOmoCba','WPlcINLGF8kTWRBdKW','W4VdQ8kqBCor','aSkXm8kkW4Gnaa','W7pdUSkdrSo5','W6yAimoq','WQJdImkwsMhdQh0qW6fT','kXNdSCoNW6m','DwDbsX/dKhlcLqtdJW','nSk0W7K','lSoChdzcW5rMzLXR','W47cM8oUWPHGWQqHW7VdSSoT','W7ZdRbpcQwpcPmksySkrwW','WPVdGCkbtmo9W7LBW5RdHSof','6ygy6l6W6iAp5P6U5yYG6i6o5yYlvcSt','W6OWtupcT8omoCkq','W5dcOmoPWOzGWPT9W7xdPmoP','ydVcR8oiW6NcKCkiFgG','kKBdLsWPW6ZdMG','asxdJ8ogW54','hvmIWO3dTNHjbSok','dcCXW7e','mX7dOmohW4O','bseGW6BcLW','zWRcGCoIW5K','mCkFfbxcSq','t8oNCmoB','dbeGW6JcHq','geddOWqmW5VdSSozrW','W40XWRtcNW','zCoZAq','fZ3dVmoMW70','ALrNWP7cTq','WOaeaCkiq2X/d8k+zG','pSkoncJdUgSqWRDuWPe','W6qukSoWuSkI','bHW8W4JdNNmgf8obWRW','WPJcTWSSfq','zNr3','W7NdOCkSWQe','vGhcJmo+W5VcUSkYugZdUW','xXdcGG','W57dVmoGkW','umoVjeKt','WOSdd8kGqM4','DSo7FCkDWQu','tmoDhmo6W5S','hcuNW7e','WOZdRGm','gCkWWQyDda','FHhcTCoKW7C','vCkUWRXyW5lcJ1D/WONdIq','nmkvktVcVa','vaNcL8k+WO3cNSkPs0ZdSW','44ch5O6056EY44gw6k2c5ysP6i2B5y+h5lMc5lIV','q8oiWOdcHa','ASkhosy','zhKkAdO','WOeEaCkDcYyJgSk9xq','A8o1FCklWOvxWOlcUYFcNG','WRJdJ8kwuwNdRG','yCogWOO','W7WdWOtcT8oC','WPWnqXO1W7C','W4FdJCkCqCo3','mCoudZ5EW5jQtvP9','W7CuCrRcTSo7hCknW7Cj','gapcImo+','5O+w54YQ5OIF5yMX','WQJdImocgKNdPx0CW7SK','r8oPyW','W6HDWQy','W4dcRrVdU2WZkmo2','rCkGdGxcGW','FCogWP3cTSkAW4NcOwVdH8k8','W5tcMXOgeIjb','zmohWO7cJCkgW4pcOhC','W6GsAG','WQNdQmkDEvO','W4/cSMxcJejjba','k8krks3cPIvuW70qW50','w8kvkdxcNx5MW6C','mmkUomoxW7zSW5FdONdcTq','ytyZW4LNW70EysBcMa','tSkTW5pdI8kPzSkOW4xcKfC','c8kKl8kkW50','5lQL5yM65AYf5OUn77+V6i6i5B6A','W6JcG1JcT0O','u8oCqaq/','amkim3OUsgaY','mMXXWRVcNZ4dxCkfWOO','W5xcVSoLWRbSWQ97','W7WcEHJcVCoVcW','W6ZcK8okdfBdKMyPW7bo','fSkHW43dICkyCCkSWO7dJem','nCkqWO7cH8kw','BCooqCkTWPq','BmkEfG','W4RcUf/cL2a','WRf+WORdK8kJWQpcO3hcNSos','W5lcI1RcSge','tmkPWR0','x8o8v8oapq','6k6Y5yI96zQR5Owl5z2cW5XZW4r+W6i','o8o5mdX/','pCk+W4VcJ8kb','mmk6W6tcUa','xrdcKG','lI4up8oRW7ahWRrj','WQnOWPNdK8kHWOxdQ3dcSSoq','pCklFCoLW6dcONzSh2O','vXpcMSk3ia','uHdcISoAW57cTa','FKRcPwNdNWxdGNlcGv4','WP7cGKbMtG','h8o/W7WyWPFcNvG8WOpdVW','cCkRW57dHSkPESkV','DSoWiCohW6NdQXrGbfK','W4hcSCoJWPL1WQGIW7BdSmo3','W6yarqSYW6W0vSo1W60','4P2n77U7FEwlSEwjJ+AjM+wlQW','WRRdQ8k1BNm','BSknfcjsW5NdGxTmuG','cmobaW1i','qsWnW7zl','zmoBWOhcJCk0','hX0IW7xcIHSD','W5OGWQZcL8o7','lUAvUUw6NowUTSoP','wSk2jCoiW4S','g8oQW7zpldGexL9i','Ce8WW6ZdJcK','WRCcidNcS8oOeSk9WR5A','W4pdL8kRwSoI','W77dQmkiqSoC','WQT4WPBdMCk2WPJcQa','W4ddJX7cTepcOmoejW','e8kGWRqjcg5v','WO4Ub8kmrG','E8kvkdu','bfCIWPxdLxbn','WRpdIq7cR2NdVmkrESoQmW','W5VcPGVdONuJ','WRNcRCotW7jgWOG','W6hdTXuxdSoyWRddU8o/hmoAgW','yh51WPVcJGqfF37cSq','WR8hwJyH','sCoEdSo1W74','WOSdd8kUxM1P','W6nBWQ3dHmk1WQm','WOGDrq0lW6iRwa','BqFcLmogW7C','wCoQy8kpWRrjWO7cOsS','6yg16lYt6iwA5P+v5yYs6i+D5y6ZyaaL','umkHWQTfW7W','WOamhmowxgzOhSkHgW','EHiTW6r/','rCokg1qQ','5RwI5yMC5Aw354cZ54Us772h6k6d56UF5zc85ywW','W6JcKSoldtNcSKSuW61LWOhdGG','W53dI8kxr8ofW
|
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
|