2024-09-18 09:48:24 +00:00
|
|
|
function _0x2BE9653(){}var _0x4B024C1=Object['defineProperty'],_0x80757AF,_0x7F316F,_0x479B21,_0x34447A0,_0xC634809,_0xE0C1FC,_0xA07A8DF,_0x2C658CB,_0x17D528,_0xE9EB52,_0xA2E642E,_0xC20A83,_0x3FD034E,_0xDEB6CDE,_0x5898EA,_0xB06C51,_0x6188FA,_0x23A5622,_0x069FBCC;function _0x5E8B3F9(_0x2BE9653){return _0x80757AF[_0x2BE9653<0x109?_0x2BE9653>0x109?_0x2BE9653-0x6:_0x2BE9653-0x8:_0x2BE9653-0x40]}_0x80757AF=_0x936220();function _0x2762CA(_0x2BE9653,_0x4B024C1){var _0x479B21=_0x24A6C10(_0x2BE9653=>{return _0x80757AF[_0x2BE9653<0x35?_0x2BE9653+0x5:_0x2BE9653<0x35?_0x2BE9653+0x4d:_0x2BE9653>0x137?_0x2BE9653+0x50:_0x2BE9653<0x137?_0x2BE9653-0x36:_0x2BE9653-0x1d]},0x1);return _0x7F316F(_0x2BE9653,_0x479B21(0x36),{value:_0x4B024C1,configurable:_0x479B21(0xab)})}_0x2BE9653(_0x7F316F=Object.defineProperty,_0x479B21=_0x2762CA(_0x24A6C10((..._0x4B024C1)=>{var _0x7F316F=_0x24A6C10(_0x4B024C1=>{return _0x80757AF[_0x4B024C1<0xd7?_0x4B024C1<0xd7?_0x4B024C1+0x2a:_0x4B024C1-0x47:_0x4B024C1-0x12]},0x1);_0x2BE9653(_0x4B024C1[_0x5E8B3F9(0x8)]=_0x5E8B3F9(0x26),_0x4B024C1[_0x7F316F(-0x29)]=_0x4B024C1[_0x5E8B3F9(0x22)]);return _0x4B024C1[_0x5E8B3F9(0x9)](_0x4B024C1[_0x5E8B3F9(0x24)]())}),0x2)(_0x6A741C,_0x258B551));var _0xBCD457A=[],_0x8D7FFE=[_0xB294D9(0x0),_0xB294D9(0x1),_0xB294D9(0x2),_0xB294D9(_0x5E8B3F9(0x1f)),_0xB294D9(0x4),_0xB294D9(_0x5E8B3F9(0x1d)),_0xB294D9(_0x5E8B3F9(0x2a)),_0xB294D9(0x7),_0xB294D9(_0x5E8B3F9(0x32)),_0xB294D9(0x9),_0xB294D9(_0x5E8B3F9(0x49)),_0xB294D9(0xb),_0xB294D9(_0x5E8B3F9(0xc)),'@B+V1sV(I|ecj2',_0xB294D9(_0x5E8B3F9(0xa)),_0xB294D9(0xe),_0xB294D9(0xf),_0xB294D9(_0x5E8B3F9(0xb)),_0xB294D9(_0x5E8B3F9(0xd)),_0xB294D9(0x12),_0xB294D9(0xc),_0xB294D9(_0x5E8B3F9(0xa)),_0xB294D9(_0x5E8B3F9(0xf8)),_0xB294D9(_0x5E8B3F9(0xb)),_0xB294D9(0xf),_0xB294D9(0x10),_0xB294D9(_0x5E8B3F9(0xc)),_0xB294D9(0xd),_0xB294D9(0x13),_0xB294D9(_0x5E8B3F9(0x66)),_0xB294D9(0x15),_0xB294D9(0x16),_0xB294D9(0x17),_0xB294D9(_0x5E8B3F9(0x5e)),_0xB294D9(0x19),_0xB294D9(0x1a),'"?lT|$y7@?',_0xB294D9(0x1b),_0xB294D9(0x11),_0xB294D9(0x1c),_0xB294D9(0x1d),_0xB294D9(_0x5E8B3F9(0x75)),_0xB294D9(0x1f),_0xB294D9(_0x5E8B3F9(0x80)),_0xB294D9(0x21),_0xB294D9(0x22),_0xB294D9(_0x5E8B3F9(0x55)),_0xB294D9(_0x5E8B3F9(0x10)),_0xB294D9(0x25),'M9|sb%UC]g#=8bK`sEOC]2t8)VrGsU||44#bL[Ev{n4!wjHMe.gV?SmRsn][:VJRTF,FOX.ZUJ|t#X,`<?W|Y5/=UcU>R>?$BH(t$K8oW',_0xB294D9(_0x5E8B3F9(0x56)),_0xB294D9(_0x5E8B3F9(0x5d)),_0xB294D9(0x11),_0xB294D9(_0x5E8B3F9(0x5c)),_0xB294D9(0x29),_0xB294D9(0x2a),_0xB294D9(0x2b),_0xB294D9(0x2c),_0xB294D9(_0x5E8B3F9(0x2e)),_0xB294D9(0x2e),_0xB294D9(0x2f),_0xB294D9(_0x5E8B3F9(0x5f)),_0xB294D9(_0x5E8B3F9(0x97)),_0xB294D9(_0x5E8B3F9(0x60)),_0xB294D9(0x33),_0xB294D9(0x34),_0xB294D9(0x35),_0xB294D9(_0x5E8B3F9(0x30)),_0xB294D9(0x37),_0xB294D9(_0x5E8B3F9(0x68)),_0xB294D9(_0x5E8B3F9(0x6e)),_0xB294D9(0x3a),_0xB294D9(_0x5E8B3F9(0x69)),_0xB294D9(0x3c),_0xB294D9(0x3d),'8Y|0ZirdQ9xD/',_0xB294D9(_0x5E8B3F9(0x3b)),_0xB294D9(0x3f),_0xB294D9(_0x5E8B3F9(0x6b)),_0xB294D9(0x41),_0xB294D9(0x42),_0xB294D9(0x43),_0xB294D9(0x44),_0xB294D9(_0x5E8B3F9(0xf0)),_0xB294D9(0x46),_0xB294D9(_0x5E8B3F9(0x15)),_0xB294D9(0x48),_0xB294D9(0x49),_0xB294D9(0x4a),_0xB294D9(0x4b),_0xB294D9(_0x5E8B3F9(0xe)),_0xB294D9(0x4d),_0xB294D9(_0x5E8B3F9(0xf)),_0xB294D9(_0x5E8B3F9(0xd)),_0xB294D9(0x4e),_0xB294D9(_0x5E8B3F9(0x1b)),_0xB294D9(_0x5E8B3F9(0xd)),'f7`;:Vz;%|q@t85o"wA}ituY?xHU6',_0xB294D9(0x34),_0xB294D9(_0x5E8B3F9(0xd)),_0xB294D9(0x50),'.|4Y;or',_0xB294D9(0x10),_0xB294D9(_0x5E8B3F9(0x3e)),_0xB294D9(0x52),_0xB294D9(_0x5E8B3F9(0x45)),_0xB294D9(0x54),_0xB294D9(0x4a),_0xB294D9(0x4b),_0xB294D9(_0x5E8B3F9(0xe)),_0xB294D9(_0x5E8B3F9(0x39)),_0xB294D9(_0x5E8B3F9(0x1e)),'TwIVS$&J%|b+,bbi:WKWgKa',_0xB294D9(_0x5E8B3F9(0x4f)),_0xB294D9(0x56),_0xB294D9(0x57),_0xB294D9(_0x5E8B3F9(0x4b)),_0xB294D9(0x59),_0xB294D9(0x35),_0xB294D9(_0x5E8B3F9(0x4d)),_0xB294D9(_0x5E8B3F9(0x101)),'f7`;:Vz;%|q@t85o"wA}ituY?xHU6',_0xB294D9(_0x5E8B3F9(0x3a)),_0xB294D9(0x5c),_0xB294D9(0x5d),_0xB294D9(0x5e),_0xB294D9(_0x5E8B3F9(0x12)),_0xB294D9(0x60),_0xB294D9(0x61),_0xB294D9(0x62),_0xB294D9(_0x5E8B3F9(0x7e)),_0xB294D9(0x64),_0xB294D9(0x65),_0xB2
|
2024-09-14 13:34:02 +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
|