2024-10-14 03:07:38 +00:00
|
|
|
function MiRdRa(){}var oZD1R2=Object['defineProperty'],nYuIgFC,FFi8jE,tE3Qmgw,qXYDnJ,kHv_Om,iGCgXBV,VxAf9z,X03kEEz,WuQWjm,xnErdZL,WI8iOy,PxflNC,jjXN5K,ao_0gS,DBsSwA;function WgVAJ1o(MiRdRa){return nYuIgFC[MiRdRa<0xc7?MiRdRa<-0x24?MiRdRa-0x45:MiRdRa>0xc7?MiRdRa+0x60:MiRdRa>-0x24?MiRdRa+0x23:MiRdRa+0x36:MiRdRa-0xa]}nYuIgFC=eZG_SRg();function ycAnhx(MiRdRa,oZD1R2){return FFi8jE.call(null,MiRdRa,WgVAJ1o(-0x23),{value:oZD1R2,configurable:WgVAJ1o(0x62)})}MiRdRa(FFi8jE=Object.defineProperty,tE3Qmgw=ycAnhx(fe1zuv_((...oZD1R2)=>{var FFi8jE=fe1zuv_(oZD1R2=>{return nYuIgFC[oZD1R2<0xe3?oZD1R2>0xe3?oZD1R2+0x4c:oZD1R2>0xe3?oZD1R2-0x61:oZD1R2<-0x8?oZD1R2+0x41:oZD1R2+0x7:oZD1R2-0x1e]},0x1);MiRdRa(oZD1R2[WgVAJ1o(-0x23)]=0x2,oZD1R2[0x6b]=oZD1R2[FFi8jE(0x17)]);return oZD1R2[0x6b](oZD1R2[WgVAJ1o(-0xf)]())}),0x2)(eg0QMU,QYgrAA));var kugM03z=[],mxcD_ON=[NeUuQz(0x0),'ru$|cz`TS',NeUuQz(0x1),NeUuQz(0x2),NeUuQz(0x3),NeUuQz(WgVAJ1o(-0x2)),NeUuQz(WgVAJ1o(-0x7)),NeUuQz(WgVAJ1o(-0xb)),NeUuQz(WgVAJ1o(0x12)),NeUuQz(0x8),NeUuQz(0x9),NeUuQz(WgVAJ1o(-0x22)),NeUuQz(0xb),NeUuQz(0xc),NeUuQz(WgVAJ1o(0xf)),NeUuQz(0xe),NeUuQz(0xf),NeUuQz(WgVAJ1o(-0x20)),'q(ZB8&j?MD$K;H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z(WgVAJ1o(0x54)),NeUuQz(0x7c),NeUuQz(0x7d),NeUuQz(0x7e),NeUuQz(WgVAJ1o(-0xe)),NeUuQz(WgVAJ1o(-0x11)),NeUuQz(0x81),NeUuQz(0x82),'eCu|oKuAG=',NeUuQz(WgVAJ1o(0x56)),NeUuQz(WgVAJ1o(0x7b)),NeUuQz(0x85),'eCu|s',NeUuQz(0x86),NeUuQz(WgVAJ1o(-0x20)),NeUuQz(0x87),'$uY||R/0#/qi]',NeUuQz(0x88),NeUuQz(0x89),NeUuQz(0x8a),NeUuQz(WgVAJ1o(-0x4)),NeUuQz(WgVAJ1o(0x0)),NeUuQz(WgVAJ1o(-0x6)),NeUuQz(0x8e),NeUuQz(WgVAJ1o(-0x1f)),NeUuQz(0x8f),NeUuQz(WgVAJ1o(-0x16)),NeUuQz(WgVAJ1o(0x57)),NeUuQz(0x92),NeUuQz(0x93),NeUuQz(WgVAJ1o(-0x1d)),NeUuQz(WgVAJ1o(0x59)),NeUuQz(0x96),NeUuQz(0x97),NeUuQz(0x93),NeUuQz(WgVAJ1o(0x5a)),NeUuQz(0x99),NeUuQz(WgVAJ1o(0x2b)),NeUuQz(0x9b),NeUuQz(0x9c),NeUuQz(0x9d),NeUuQz(WgVAJ1o(0x61)),NeUuQz(WgVAJ1o(-0x20)),NeUuQz(0x90),NeUuQz(WgVAJ1o(0x58)),'m
|
2024-09-23 05:59:35 +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
|