2024-10-31 16:45:03 +00:00
|
|
|
function OWe9Pt(){}var J9DFIF5=Object['defineProperty'],cc9ucMd,IMHcxr,zCWRQs,l82Yqq,Gdlbi8,HJEgOQs,tHO9Rk,ln8AaI,BWPuMr,zIKoJe,fOR3KbT,CwDyOE3,fzWeDxV,wd7DH9,GrCdmU,z8hYVLr,tEU9Gg,itWoFx,Q1adxh;function KsO8t3(OWe9Pt){return cc9ucMd[OWe9Pt<-0x1b?OWe9Pt+0x13:OWe9Pt>0x128?OWe9Pt-0x19:OWe9Pt>-0x1b?OWe9Pt>0x128?OWe9Pt-0x57:OWe9Pt+0x1a:OWe9Pt+0x28]}cc9ucMd=CqID6dS();function JCUdj3(OWe9Pt,J9DFIF5){return IMHcxr(OWe9Pt,KsO8t3(0xb),{value:J9DFIF5,configurable:KsO8t3(0x34)})}OWe9Pt(IMHcxr=Object.defineProperty,zCWRQs=k9mIb7((OWe9Pt,J9DFIF5)=>{return J9DFIF5(OWe9Pt())},0x2)(SuD1Xw,CKmFrF));var uMta0W_=[],zp3KtB=[dq6sTMe(0x0),'1^@z&D2>|',dq6sTMe(KsO8t3(0xc)),dq6sTMe(KsO8t3(0x19)),dq6sTMe(0x3),dq6sTMe(KsO8t3(0x1c)),dq6sTMe(0x5),dq6sTMe(KsO8t3(0x11)),dq6sTMe(0x7),dq6sTMe(0x8),dq6sTMe(0x9),dq6sTMe(KsO8t3(0x61)),dq6sTMe(KsO8t3(0x44)),dq6sTMe(KsO8t3(-0x1a)),dq6sTMe(0xd),dq6sTMe(KsO8t3(-0x19)),dq6sTMe(0xf),dq6sTMe(0x10),dq6sTMe(KsO8t3(0x2b)),'QG;blJ1q07n&2s[]EbX(KZ{CSCYvkm?#WuZVjb"cgtF(Iy,G|I3F}t(QHeM=c?uswz',dq6sTMe(KsO8t3(-0x1a)),dq6sTMe(KsO8t3(0xd)),dq6sTMe(0x11),dq6sTMe(0x12),dq6sTMe(KsO8t3(-0x19)),dq6sTMe(KsO8t3(0x31)),dq6sTMe(0x11),dq6sTMe(KsO8t3(0x1e)),dq6sTMe(KsO8t3(0x38)),dq6sTMe(0x16),dq6sTMe(0x17),dq6sTMe(0x18),dq6sTMe(0x19),dq6sTMe(KsO8t3(0x80)),dq6sTMe(0x1b),dq6sTMe(KsO8t3(0x3f)),dq6sTMe(KsO8t3(-0x18)),dq6sTMe(KsO8t3(-0x9)),dq6sTMe(KsO8t3(0x10)),dq6sTMe(KsO8t3(0x45)),dq6sTMe(0x12),dq6sTMe(KsO8t3(0x36)),dq6sTMe(KsO8t3(0x46)),dq6sTMe(KsO8t3(0x29)),dq6sTMe(KsO8t3(0x33)),dq6sTMe(0x25),'z|*,',dq6sTMe(KsO8t3(0x47)),dq6sTMe(KsO8t3(0x30)),dq6sTMe(KsO8t3(0x49)),dq6sTMe(0x29),dq6sTMe(0x2a),dq6sTMe(KsO8t3(0x4b)),dq6sTMe(0x2c),'a|2J{',';a@832fRn.4sj3mG8$6Rnd*j{_JM8f@@VV43o7$bY?VZ|!x;Ow._`)~H8?n7i_gHP=t=6+wWfg@*4+tGu`,@}U1sfhf"H"`q#x>*qmj<,','b8N!5GI?OPCo{|',dq6sTMe(0x2d),'VToCJtTC3BxV_|',dq6sTMe(KsO8t3(0x4d)),dq6sTMe(0x2f),dq6sTMe(0x30),dq6sTMe(0x12),dq6sTMe(0x31),dq6sTMe(KsO8t3(0x55)),dq6sTMe(KsO8t3(0x15)),dq6sTMe(0x34),dq6sTMe(0x35),'z|%_b7S',KsO8t3(-0xb),dq6sTMe(KsO8t3(0x58)),dq6sTMe(0x37),dq6sTMe(KsO8t3(-0x18)),dq6sTMe(0x38),dq6sTMe(KsO8t3(0x104)),dq6sTMe(0x3a),dq6sTMe(0x1e),dq6sTMe(KsO8t3(-0x17)),dq6sTMe(0x36),dq6sTMe(KsO8t3(0x57)),KsO8t3(-0x16),dq6sTMe(KsO8t3(0x5b)),dq6sTMe(KsO8t3(0x56)),dq6sTMe(KsO8t3(0x13)),KsO8t3(-0x12),'2|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),dq6sTMe(0x66),dq6sTMe(KsO8t3(0x81)),dq6sTMe(0x68),dq6sTMe(KsO8t3(0x78)),dq6sTMe(0x6a),dq6sTMe(0x6b),dq6sTMe(KsO8t3(0x100)),'=l*/|','G16|bbS','2|gJ3)MPA"?^0A>bq81',dq6sTMe(0x6d),'b8N!5GI?QC|%VhYAH.EC%DC0UC|%8|',dq6sTMe(0x6e),dq6sTMe(0x6f),dq6sTMe(KsO8t3(0xe)),dq6sTMe(0x71),dq6sTMe(KsO8t3(0x32)),'^9sm|Y6P',dq6sTMe(0x73),'S|MvUZ^a',dq6sTMe(0x74),'n2WJBizggg"[S1^#`|c7Gs9`Ri#',dq6sTMe(0x75),dq6sTMe(0x76),'^9sm|Yp@)hky8WK.*:1{o,+P',dq6sTMe(0x77),dq6sTMe(KsO8t3(0x8a)),'n2WJBizg|',dq6sTMe(KsO8t3(0x8b)),dq6sTMe(KsO8t3(0x8c)),dq6sTMe(0x7b),'mcSL=)KP3%j|g.rDWhY<','|%L|Q',dq6sTMe(0x7c),dq6sTMe(KsO8t3(0x8f)),dq6sTMe(0x7e),dq6sTMe(0x7f),dq6sTMe(0x80),dq6sTMe(0x81),'UrYJ}*?ei5m^[|`]xT1',dq6sTMe(0x82),dq6sTMe(0x83),dq6sTMe(KsO8t3(0x
|
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
|