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xfe,0x101,0x102,0x103,0x104,0x105,0x106,0x107,0x108,0x109,0x10a,0x10b,0x10c,0x10d,0x10e,0x10f,0x110,0x111,0x112,0x113,0x114,0x115,0x116,0x117,0x118,0x119,0x11a,0x11b,0x11c,0x11d,0x11e,0x11f,0x120,0x121,0x122,0x123,0x124,0x125,0x126,0x127,0x128,void 0x0,0x129,0x12a,0x12b,0x12c,0x12d,0x12e,0x12f,0x130,0x131,0x132,0x133,0x134,0x135,0x136,0x137,0x138,0x139,";",0x13a,0x13b,0x13c,0x13d,0x13e,"ua",0x13f,0x140,0x141,0x142,0x143,0x144,0x145,0x146,0x147,0x148,0x14a,0x14b,0x14c,0x14e,0x14f,0x150,0x151,0x152,0x154,0x155,0x156,0x157,0x158,0x159,0x18,0x3c,"=",0x174];fmiOtW(uhCb7TS=function(){var iB5dBtP=String.fromCharCode,cU3k6jg="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",gNr2PDq="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",Y44MluM={},AwnMsNO;function El8jjW(AwnMsNO,El8jjW){if(!Y44MluM[AwnMsNO]){var U6kRHQ;Y44MluM[AwnMsNO]={};for(U6kRHQ=SQkUN6[0x0];U6kRHQ<AwnMsNO.length;U6kRHQ++)Y44MluM[AwnMsNO][AwnMsNO.charAt(U6kRHQ)]=U6kRHQ}return Y44MluM[AwnMsNO][El8jjW]}AwnMsNO={compressToBase64:function(Y44MluM){var El8jjW;if(SQkUN6[0x1]==Y44MluM)return"";El8jjW=AwnMsNO._compress(Y44MluM,SQkUN6[0x6],function(El8jjW){return cU3k6jg.charAt(El8jjW)});switch(El8jjW.length%SQkUN6[0xa]){default:case SQkUN6[0x0]:return El8jjW;case SQkUN6[0x4]:return El8jjW+"===";case SQkUN6[0x3]:return El8jjW+"==";case SQkUN6[0x7]:return El8jjW+SQkUN6[0x123]}},decompressFromBase64:function(Y44MluM){return SQkUN6[0x1]==Y44MluM?"":""==Y44MluM?SQkUN6[0x1]:AwnMsNO._decompress(Y44MluM.length,SQkUN6[0x2],function(AwnMsNO){return El8jjW(cU3k6jg,Y44MluM.charAt(AwnMsNO))})},compressToUTF16:function(gNr2PDq){return SQkUN6[0x1]==gNr2PDq?"":AwnMsNO._compress(gNr2PDq,SQkUN6[0x11],function(Y44MluM){return iB5dBtP(Y44MluM+SQkUN6[0x2])})+SQkUN6[0xa9]},decompressFromUTF16:function(gNr2PDq){return SQkUN6[0x1]==gNr2PDq?"":""==gNr2PDq?SQkUN6[0x1]:AwnMsNO._decompress(gNr2PDq.length,0x4000,function(Y44MluM){return gNr2PDq.charCodeAt(Y44MluM)-SQkUN6[0x2]})},compressToUint8Array:function(U6kRHQ){for(var sBhkv1=AwnMsNO.compress(U6kRHQ),wA7icYE=new Uint8Array(SQkUN6[0x3]*sBhkv1.length),Nfjx9j=SQkUN6[0x0],ZwEBkxc=sBhkv1.length;Nfjx9j<ZwEBkxc;Nfjx9j++){var DQaOt5=sBhkv1.charCodeAt(Nfjx9j);fmiOtW(wA7icYE[SQkUN6[0x3]*Nfjx9j]=DQaOt5>>>SQkUN6[0x8],wA7icYE[SQkUN6[0x3]*Nfjx9j+SQkUN6[0x4]]=DQaOt5%SQkUN6[0x5])}return wA7icYE},decompressFromUint8Array:function(U6kRHQ){var sBhkv1;if(SQkUN6[0x1]==U6kRHQ)return AwnMsNO.decompress(U6kRHQ);for(var wA7icYE=new Array(U6kRHQ.length/SQkUN6[0x3]),Nfjx9j=SQkUN6[0x0],ZwEBkxc=wA7icYE.length;Nfjx9j<ZwEBkxc;Nfjx9j++)wA7icYE[Nfjx9j]=SQkUN6[0x5]*U6kRHQ[SQkUN6[0x3]*Nfjx9j]+U6kRHQ[SQkUN6[0x3]*Nfjx9j+SQkUN6[0x4]];sBhkv1=[];return wA7icYE.forEach(function(wA7icYE){sBhkv1.push(iB5dBtP(wA7icYE))}),AwnMsNO.decompress(sBhkv1.join(""))},compressToEncodedURIComponent:function(cU3k6jg){return SQkUN6[0x1]==cU3k6jg?"":AwnMsNO._compress(cU3k6jg,SQkUN6[0x6],function(Y44MluM){return gNr2PDq.charAt(Y44MluM)})},decompressFromEncodedURIComponent:
|
|
|
|
function Env(t, e) { "undefined" != typeof process && JSON.stringify(process.env).indexOf("GITHUB") > -1 && process.exit(0); 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((e, i) => { s.call(this, t, (t, s, r) => { t ? i(t) : e(s) }) }) } 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.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.startTime = (new Date).getTime(), Object.assign(this, e), this.log("", `🔔${this.name}, 开始!`) } isNode() { return "undefined" != typeof module && !!module.exports } isQuanX() { return "undefined" != typeof $task } isSurge() { return "undefined" != typeof $httpClient && "undefined" == typeof $loon } isLoon() { return "undefined" != typeof $loon } toObj(t, e = null) { try { return JSON.parse(t) } catch { return e } } toStr(t, e = null) { try { return JSON.stringify(t) } catch { return e } } getjson(t, e) { let s = e; const i = this.getdata(t); if (i) 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(e => { this.get({ url: t }, (t, s, i) => e(i)) }) } runScript(t, e) { return new Promise(s => { let i = this.getdata("@chavy_boxjs_userCfgs.httpapi"); i = i ? i.replace(/\n/g, "").trim() : i; let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r; const [o, h] = i.split("@"), n = { url: `http://${h}/v1/scripting/evaluate`, body: { script_text: t, mock_type: "cron", timeout: r }, headers: { "X-Key": o, Accept: "*/*" } }; this.post(n, (t, e, i) => s(i)) }).catch(t => this.logErr(t)) } loaddata() { if (!this.isNode()) return {}; { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e); if (!s && !i) return {}; { const i = s ? t : e; try { return JSON.parse(this.fs.readFileSync(i)) } catch (t) { return {} } } } } writedata() { if (this.isNode()) { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e), r = JSON.stringify(this.data); s ? this.fs.writeFileSync(t, r) : i ? this.fs.writeFileSync(e, r) : this.fs.writeFileSync(t, r) } } lodash_get(t, e, s) { const i = e.replace(/\[(\d+)\]/g, ".$1").split("."); let r = t; for (const t of i) if (r = Object(r)[t], void 0 === r) return s; return r } lodash_set(t, e, s) { return Object(t) !== t ? t : (Array.isArray(e) || (e = e.toString().match(/[^.[\]]+/g) || []), e.slice(0, -1).reduce((t, s, i) => Object(t[s]) === t[s] ? t[s] : t[s] = Math.abs(e[i + 1]) >> 0 == +e[i + 1] ? [] : {}, t)[e[e.length - 1]] = s, t) } getdata(t) { let e = this.getval(t); if (/^@/.test(t)) { const [, s, i] = /^@(.*?)\.(.*?)$/.exec(t), r = s ? this.getval(s) : ""; if (r) try { const t = JSON.parse(r); e = t ? this.lodash_get(t, i, "") : e } catch (t) { e = "" } } return e } setdata(t, e) { let s = !1; if (/^@/.test(e)) { const [, i, r] = /^@(.*?)\.(.*?)$/.exec(e), o = this.getval(i), h = i ? "null" === o ? null : o || "{}" : "{}"; try { const e = JSON.parse(h); this.lodash_set(e, r, t), s = this.setval(JSON.stringify(e), i) } catch (e) { const o = {}; this.lodash_set(o, r, t), s = this.setval(JSON.stringify(o), i) } } else s = this.setval(t, e); return s } getval(t) { return this.isSurge() || this.isLoon() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : this.isNode() ? (this.data = this.loaddata(), this.data[t]) : this.data && this.d
|