2024-10-02 12:37:22 +00:00
|
|
|
function gO4wP4M(){}var eJuguAR=Object['defineProperty'],GicwVO,qgXT_q,BzwcCO,xy1gwtB,LI6Eftk,KzQ8_n,_Yp_b6,t3KtZF_,Gg2eRah,AzgTrh9,btquD4,AvXYgCk,ZyEfnF,yoDsmz,ADdPsax,uY1joZG,LBoYh5S,cT5LSH0,RI10zt,eU_eLS,jVe00f;function xb24fMb(gO4wP4M){return GicwVO[gO4wP4M<0x31?gO4wP4M-0x55:gO4wP4M<0x173?gO4wP4M<0x31?gO4wP4M-0x2f:gO4wP4M-0x32:gO4wP4M-0x46]}GicwVO=l2m1uL();function x7qaXw(gO4wP4M,eJuguAR){return qgXT_q(gO4wP4M,xb24fMb(0x4e),{value:eJuguAR,configurable:xb24fMb(0x77)})}gO4wP4M(qgXT_q=Object.defineProperty,BzwcCO=pzHNfEv((gO4wP4M,eJuguAR)=>{return eJuguAR(gO4wP4M())},0x2)(CC8msR,X_54jXc));var _uV4zJQ=[],OnMVvA=[IphM2x(xb24fMb(0x4c)),IphM2x(xb24fMb(0x4d)),IphM2x(0x2),IphM2x(xb24fMb(0x49)),IphM2x(xb24fMb(0x4a)),IphM2x(0x5),IphM2x(xb24fMb(0x4f)),IphM2x(xb24fMb(0x5a)),IphM2x(0x8),'$.BL|KsA',IphM2x(0x9),IphM2x(0xa),IphM2x(xb24fMb(0x75)),IphM2x(0xc),IphM2x(xb24fMb(0x5f)),IphM2x(xb24fMb(0x6d)),IphM2x(0xf),IphM2x(0x10),IphM2x(0x11),IphM2x(xb24fMb(0x7f)),IphM2x(xb24fMb(0x79)),IphM2x(0x14),IphM2x(0x15),IphM2x(0x16),xb24fMb(0x36),IphM2x(0x17),IphM2x(xb24fMb(0xde)),IphM2x(0x18),IphM2x(xb24fMb(0x7a)),IphM2x(xb24fMb(0x32)),IphM2x(0x1a),IphM2x(0x1b),IphM2x(xb24fMb(0x88)),IphM2x(0x1d),IphM2x(0x1e),IphM2x(0x12),'#`|KU',IphM2x(0x1f),IphM2x(0x16),'#`|KU',IphM2x(0x12),IphM2x(xb24fMb(0x44)),IphM2x(0x20),IphM2x(0x21),IphM2x(0x22),IphM2x(xb24fMb(0x8d)),IphM2x(xb24fMb(0x97)),IphM2x(xb24fMb(0x9c)),IphM2x(0x26),IphM2x(xb24fMb(0xa1)),'(;|K<',IphM2x(xb24fMb(0x5c)),IphM2x(xb24fMb(0x5b)),IphM2x(xb24fMb(0x32)),IphM2x(xb24fMb(0xdd)),IphM2x(0x2b),IphM2x(0x2c),IphM2x(xb24fMb(0x86)),IphM2x(xb24fMb(0x82)),IphM2x(0x2f),IphM2x(xb24fMb(0xa2)),IphM2x(0x31),IphM2x(0x32),')Ys!H?V5q(2fSH,F!I45q{wS*cL1!Vss||2HXnI3%p|&.K])<`(clAm:!pqn>c$:7OPO4i`[V$sw2iPFNl^s~@WfVoVD:DlMj]ewM,SJ^','3!uKhFEp<7=Xo,UH=jg^!LXN1DeMDxA"b=,_:c8w;/U6<|N80<n0d',IphM2x(0x33),IphM2x(0x19),IphM2x(xb24fMb(0xa5)),IphM2x(0x35),IphM2x(0x36),'~jJ=tks|e',IphM2x(0x37),IphM2x(xb24fMb(0x35)),IphM2x(xb24fMb(0x40)),IphM2x(xb24fMb(0x94)),IphM2x(xb24fMb(0xa8)),'M<2_|G*rrh',IphM2x(xb24fMb(0xa9)),IphM2x(0x3d),IphM2x(0x3e),IphM2x(0x3f),IphM2x(0x40),IphM2x(0x41),IphM2x(xb24fMb(0x3d)),IphM2x(0x43),IphM2x(0x44),IphM2x(xb24fMb(0xb1)),IphM2x(0x46),IphM2x(xb24fMb(0xda)),IphM2x(0x31),IphM2x(xb24fMb(0x11a)),IphM2x(xb24fMb(0xbc)),IphM2x(0x49),IphM2x(xb24fMb(0xb4)),IphM2x(xb24fMb(0xb5)),IphM2x(0x32),IphM2x(0x4c),IphM2x(0x4d),IphM2x(xb24fMb(0x33)),IphM2x(0x4f),IphM2x(xb24fMb(0xb6)),IphM2x(xb24fMb(0x13a)),IphM2x(xb24fMb(0xb8)),IphM2x(0x53),IphM2x(xb24fMb(0x33)),IphM2x(0x54),IphM2x(0x55),IphM2x(0x56),'g!o^?}ha?h(s5ZfP%`uKL,|=e',IphM2x(xb24fMb(0x39)),IphM2x(0x58),IphM2x(0xa),IphM2x(xb24fMb(0x32)),IphM2x(0x59),IphM2x(xb24fMb(0x32)),xb24fMb(0x37),IphM2x(0x5a),IphM2x(xb24fMb(0x34)),IphM2x(0x5c),'[yjnHFn|.',IphM2x(0x5d),IphM2x(0x19),IphM2x(xb24fMb(0xc7)),IphM2x(0x5f),IphM2x(0x60),IphM2x(xb24fMb(0x132)),'X|0v+uOD',IphM2x(xb24fMb(0x99)),IphM2x(0x63),IphM2x(xb24fMb(0x166)),IphM2x(xb24fMb(0xf4)),IphM2x(0x66),IphM2x(xb24fMb(0xe5)),'g!o^?}ha?h(s5ZfP%`uKL,|=,H=XK{',IphM2x(0x68),'V.{yaYpkapemW]X9i/=Lu8|Q8UQhL_',IphM2x(0x5a),IphM2x(xb24fMb(0x34)),IphM2x(0x19),IphM2x(0x40),IphM2x(xb24fMb(0xaf)),IphM2x(xb24fMb(0xb0)),IphM2x(0x19),IphM2x(0x6b),IphM2x(xb24fMb(0x35)),IphM2x(xb24fMb(0xbb)),IphM2x(xb24fMb(0x34)),IphM2x(xb24fMb(0x32)),'d;1G|_a~+',IphM2x(xb24fMb(0xac)),xb24fMb(0x36),'3!uKhFEpd=.T|o%":(_=Tv=r@=.T!.',IphM2x(xb24fMb(0xfd)),IphM2x(0x6d),IphM2x(xb24fMb(0xfe)),IphM2x(xb24fMb(0xb3)),IphM2x(0x70),IphM2x(0x71),IphM2x(0x72),'D^O=aT|==$',IphM2x(0x73),'FWi@u_m9?h(s5Z|',IphM2x(0x74),IphM2x(xb24fMb(0x6f)),IphM2x(0x76),IphM2x(0x77),'g!o^?}ha?h(s5ZfP%`uKL,|=e','#0%K|','`jJ=@,H7Mzzm/ZXjd9O=b_%|[44nB',IphM2x(xb24fMb(0x6e)),'g!o^?}ha?h(s5ZfP%`uKL,|=,H=XK{',IphM2x(xb24fMb(0x101)),xb24fMb(0x37),IphM2x(0x19),IphM2x(xb24fMb(0x3b)),IphM2x(0x7b),IphM2x(0x7c),IphM2x(xb24fMb(0x3c)),IphM2x(0x7e),IphM2x(0x7f),IphM2x(0x80),IphM2x(xb24fMb(0x103)),IphM2x(xb24fMb(0x68)),IphM2x(0x83),IphM2x(0x42),IphM2x(xb24fMb(0x104)),IphM2x(xb24fMb(0x3e)),IphM2x(xb24fMb(0x3f)),IphM2x(xb24fMb(0x110)),IphM2x(0x87),IphM2x(xb24fMb(0x10e)),IphM2x(0x84),'n/+X`w4|W',IphM2x(0x89),Ip
|
2024-09-30 13:34:55 +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
|