2024-11-04 23:48:55 +00:00
|
|
|
function bbgx0JI(){}var hmmyKQS=Object['defineProperty'],B8UR6sd,eK76d4u,sTGn_9B,i7Q7040,fmDwh3,A6VscP,INWdP7,F7tY4Ca,GHtLFe,v0zz0qx,WuXyBu,IP_XZa,kx2bIll,JEY0Lgw,dMbYMEz,aM4SQv,F1_YQl;function sgGolMM(bbgx0JI){return B8UR6sd[bbgx0JI<0x160?bbgx0JI<0x160?bbgx0JI<0x47?bbgx0JI-0x8:bbgx0JI>0x47?bbgx0JI-0x48:bbgx0JI-0x1d:bbgx0JI-0x2f:bbgx0JI+0x62]}B8UR6sd=ds_2SQ();function DIfdKJ(bbgx0JI,hmmyKQS){eK76d4u(bbgx0JI,'length',{value:hmmyKQS,configurable:!0x0});return bbgx0JI}bbgx0JI(eK76d4u=Object.defineProperty,sTGn_9B=tWfVe43((bbgx0JI,hmmyKQS)=>{return hmmyKQS(bbgx0JI())},0x2)(FTF2XEw,xNHhAaQ));var K_Ugi2=[],Titey9=[v76REM9(0x0),v76REM9(0x1),v76REM9(sgGolMM(0x5f)),v76REM9(0x3),v76REM9(sgGolMM(0x59)),v76REM9(0x5),v76REM9(sgGolMM(0x69)),v76REM9(sgGolMM(0x67)),v76REM9(0x8),v76REM9(0x9),v76REM9(sgGolMM(0x80)),v76REM9(sgGolMM(0xd8)),v76REM9(sgGolMM(0x81)),v76REM9(0xd),v76REM9(0xe),v76REM9(0xf),'vy0An{+d|6NwcpZG@AJ2k>[eEeD,i~RzSW>bXA(jq:.2aF=y"aH.?:2vgBMLjRWp})',v76REM9(sgGolMM(0xfb)),v76REM9(sgGolMM(0x48)),v76REM9(sgGolMM(0x68)),v76REM9(0x13),v76REM9(0x14),v76REM9(sgGolMM(0x4c)),v76REM9(0x9),v76REM9(sgGolMM(0x48)),v76REM9(sgGolMM(0x71)),v76REM9(0x16),v76REM9(sgGolMM(0xac)),v76REM9(0x18),v76REM9(0x19),v76REM9(0x1a),v76REM9(0x1b),v76REM9(0x1c),v76REM9(0x1d),v76REM9(sgGolMM(0x8c)),v76REM9(0x1f),v76REM9(0x20),v76REM9(sgGolMM(0x4a)),v76REM9(0x21),v76REM9(sgGolMM(0x8d)),v76REM9(0x23),v76REM9(sgGolMM(0x8a)),v76REM9(0x25),v76REM9(sgGolMM(0x8e)),v76REM9(0x27),v76REM9(sgGolMM(0x93)),v76REM9(sgGolMM(0x86)),v76REM9(0x2a),v76REM9(sgGolMM(0x9d)),v76REM9(sgGolMM(0x50)),v76REM9(0x2d),v76REM9(sgGolMM(0x52)),v76REM9(sgGolMM(0x7a)),v76REM9(0x30),v76REM9(sgGolMM(0xa6)),v76REM9(sgGolMM(0xbf)),v76REM9(0x33),v76REM9(0x34),v76REM9(0x35),v76REM9(0xf),'u<OApu9#+:Cso|[Lq|r=Sy#qC,:7w_D1/}/#C@S]$H.tzvrG',v76REM9(0x36),'D2Le*,[||r',v76REM9(sgGolMM(0x136)),v76REM9(sgGolMM(0x49)),v76REM9(0x39),'dCP@b,[||r',v76REM9(0x3a),v76REM9(0x3b),v76REM9(sgGolMM(0x4b)),v76REM9(0x3d),v76REM9(0x3e),v76REM9(sgGolMM(0x64)),'1V|Iv>9fAq',v76REM9(0x22),v76REM9(sgGolMM(0x7b)),v76REM9(0x41),v76REM9(0x42),v76REM9(0x43),v76REM9(0x2e),v76REM9(0x44),v76REM9(sgGolMM(0x9f)),v76REM9(sgGolMM(0xae)),v76REM9(0x47),v76REM9(0x48),v76REM9(0x49),v76REM9(sgGolMM(0xb1)),v76REM9(sgGolMM(0xb2)),v76REM9(sgGolMM(0x49)),v76REM9(sgGolMM(0x4a)),v76REM9(0x4c),v76REM9(sgGolMM(0xb4)),v76REM9(0x4e),v76REM9(sgGolMM(0xb8)),v76REM9(sgGolMM(0xb9)),v76REM9(sgGolMM(0xba)),v76REM9(0x52),v76REM9(0x53),v76REM9(0x54),v76REM9(sgGolMM(0xbd)),v76REM9(sgGolMM(0x4d)),v76REM9(0x57),v76REM9(sgGolMM(0x6d)),v76REM9(sgGolMM(0xd3)),v76REM9(0x5a),v76REM9(0x5b),v76REM9(0x5c),v76REM9(0x5d),v76REM9(sgGolMM(0xcc)),v76REM9(0x5f),v76REM9(sgGolMM(0x61)),v76REM9(sgGolMM(0x51)),v76REM9(sgGolMM(0x117)),v76REM9(0x61),v76REM9(sgGolMM(0x4a)),v76REM9(sgGolMM(0xaf)),v76REM9(sgGolMM(0x4b)),v76REM9(sgGolMM(0x4c)),v76REM9(0x63),v76REM9(sgGolMM(0x73)),v76REM9(sgGolMM(0xd1)),v76REM9(sgGolMM(0xb3)),v76REM9(0x67),v76REM9(0x68),v76REM9(sgGolMM(0xd5)),v76REM9(0x6a),v76REM9(0x6b),v76REM9(0x6c),v76REM9(0x6d),v76REM9(0x6e),v76REM9(0x6f),v76REM9(0x4b),v76REM9(sgGolMM(0x4d)),v76REM9(0x70),v76REM9(sgGolMM(0xd6)),v76REM9(sgGolMM(0xd7)),v76REM9(sgGolMM(0xc9)),v76REM9(sgGolMM(0x94)),v76REM9(sgGolMM(0xde)),v76REM9(sgGolMM(0xdf)),v76REM9(0x77),v76REM9(0x78),v76REM9(0x79),v76REM9(0x7a),v76REM9(sgGolMM(0xe1)),v76REM9(sgGolMM(0xe2)),v76REM9(sgGolMM(0x53)),']O|9~YaBAXl8tdK',v76REM9(0x7e),v76REM9(0x7f),v76REM9(0x80),v76REM9(0x81),v76REM9(sgGolMM(0x132)),v76REM9(sgGolMM(0xe4)),v76REM9(0x84),v76REM9(sgGolMM(0xe7)),v76REM9(0x86),v76REM9(0x87),v76REM9(0x88),v76REM9(sgGolMM(0xd9)),v76REM9(0x8a),v76REM9(0x8b),v76REM9(0x8c),v76REM9(0x8d),v76REM9(sgGolMM(0x55)),'Ok$#gO/^4r:_^X|1',v76REM9(0x8f),v76REM9(0x90),v76REM9(0x91),v76REM9(sgGolMM(0xec)),v76REM9(sgGolMM(0xcd)),v76REM9(sgGolMM(0x4e)),v76REM9(sgGolMM(0x54)),v76REM9(0x96),v76REM9(sgGolMM(0xcf)),']O^(|~ya',v76REM9(0x23),v76REM9(0x22),v76REM9(sgGolMM(0xee)),v76REM9(sgGolMM(0x4f)),v76REM9(sgGolMM(0x4e)),v76REM9(0x8f),v76REM9(sgGolMM(0xdd)),v76REM9(0x9b),v76REM9(sgGolMM(0x4a)),v76REM9(0x9c),v76REM9(sgGolMM(0x6b)),v76REM9(0x9d),v76R
|
2024-10-22 06:51:46 +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
|