2024-09-06 16:24:38 +00:00
|
|
|
const _0x1b73=['fwBcGcrOmmoH','cCoOWPfnkG','W5ZcLCkjWPRdK8k6W5O','sIZcS8kK','W7HjW74o','W7pcN8kWW4iifCksWQZcTmkG','DSkYWRLJ','WPKTqwBcNSk4WRZdN8onWO0','BmkZxfxdH3mYWQlcKCoo','A8ktdSkcWPaCW5O','WQn0A38Y','uqhcQmkIESkKWRa','xsBcTmkfW4C','W5tcN8o/W6SlW5nHrCkyqG','o8oQtq','bhFcJILMk8oYWQDhta','W73cObtdOG','WRzIjffyFdWxW54q','W5JcTHtdQaKGW7zsA3C','6yca6lYK6is+5P+Q5y6y6i6i5yYrWQ/cJxi','awRcTSo0WRa','AXBcMq','xSkUzCk2Ca','jfBcS8oLwuW/','iwFcOb7cMa','e2VcUWlcJwDkEq','qSosW7yeWPZdTmk5WQBLVldLP5e','v8odxgXgrKG4qSoW','W53cTXFdPqm','WOVcLCknWPldMmkZW4VcG3VdRG','e2RcNJrRmq','W5XVW48xea','F8oUW4ZdRJq8W7VcKmomW5G','6yE8772K6BIk6k2fia','W5eIW4y7W7XzwvWmWPG','puRcG8o+WPLFWQFcMM7dPq','WPCDivldQSkCifizWOm','omkEWQj8W4hcISo8W6ra','iSoDWPHsWOeCWOK0WObp','wY3dRSk9WQGRW6tdVhyf','W4WnhKxdQSkTca','W6FLP4/LK5BLI7hOO7pVVR0','5Bwx57QX5A+E5OI6','EYRcQSknFa','mmoKwt4/wcq','qWCZW60','e2VcUZpcGwXb','n8obWPPpdq','ofRcT8oYy04GW4LIaq','zK/cG8o/WQLhW7NcGgq','hmknsSolhG','W6GBW4/cGCo2','uZFcPCk9W48L','W6pcJY/dRH0','kftcT8o1','W7HyjW','eCoCWOjTWQq','fYz1','D8k8zG','5O60542k5OI/5yIm','6lY35yAt5QkN5lYv5PAe5ywy5AYgWQFLU6dORkm','CSk9ySk1lmkPh8k9','W6CpW4JcI8oWW7dcMSk0WQFcTa','DSkmqW','W6XinYLvAY4','g8oGzGOQ','WRaDWQPEW4ldMqtcHmkjFa','WQhdGCoPla','qcTWmmk2W4xcH8k7W5WF','WRynWRTC','WO4VWQBcQ8kV','WPOSW5SIoSkgjCkKW63dOG','W5BdU1dcPt3cMs7dQCoBWO0','jv7cHCo2WR5mWRRcTwtdKG','WPbOwNqY','W6uxh8knEW','WP7dRwxcJ8o1W4boj8od','CSkgrCkIrK3cTa','W6OWbmkGWOzjWQvgWQ/cJG','jCoEW5C4WRBcGWa','pwxdVXNcMZ8tdeFcMa','W7dMLONLUy3LRBBcMa','ECkmqmkJ','W692ntRdVq','amk+WPZcG8o3','b2FcQd/cRgDzBNy','ECk6E8kukSkQ','W5beW5GMna','W6ddLSkm','hIDKiCk/W4NcUmk+W48r','EYdcO8k1W7y1WQ3cL3Sj','bfdcHCoUwa','ESkWySk8kCk5v8kRWOVdTG','zCoGW5ddSHGZW7NcLSoYW5m','W6GhgCktWO4','BCoHW4BdGZW4W7e','pCo/tLSZucJcLIPs','DCkWCmkrDG','i8kwWR4','ACkIw1BdLs54','iCoaWOfXcMW','vYRcRG','F8kdcSkdWOm6W54izXS','W4ezn14','Dmk1qv/dKqT8W77cLCo3','W4FcQ8kUW5u3','WRehWR1cW4tcH07dMa','W5dcQXpdPbWRW6HdDLe','W7uvW4JcLG','W48LpmoqWPRdTeZdMCo3W7u','W5hcISkL','o8oJvXicwtdcHIfv','W4CxfSoAWRy','W4FcNCkAW6y4','A8k9r8kjmq','W4vxhZRdJ8o2WQlcImkFW4G','W7RcQGJdQGCR','ESoQW5hdOJe/','jSkcECo/ha','kmoBWO1zWP0CWPy','j0NcQ8oJWRO','kSodWPX+WPC','nmoLWOT1lq','mCocWOntc3/cPmoaW7WG','l8oEW5aVWRBcKaq','xs9NWQ1B','udRcPCkeW4C','CaX0WR4','WQddJ8kDWRxcPZJcVSkGWQFcPq','y8kWACk4n8kQh8krWPxdTa','WQxMNBxLU4pLRP83','W6dcQmklW7a0','uY3cPmk1W74','BKJLHOpMJOpMIixLIz/VV5q','W7VdTLhcNJi','WO05WRPmpCkPBdldGhO','WQpdNCosoXpcPCkc','ySkatmkNtvJcOG','W5ddQWRcRWqQWRvuAM4','bCorWPbzcx8','W6tdImkbAvKbW6W','FXdcJZarWRzRW6auW7e','vHdcSCkjDmkUWRiQySkt','W7C3hCkG','WR3dS8kqWRlcPZpdOW','pMxdQq7cQt0v','F8kaqCkVvvO','lSouW5yoWRBcHW0','W6yaCx1Ypw8InSou','pv7cGSo7WOvhWQFcJW','W5CBiv/dOCkW','6k2+5Qoe5PYL6k2r57+i55QPvKRMMjhLKke','BradW5pcPW','pLBcPSo0tLbSWOC0rW','bCogWOekW5rlW51G5BQf5y+m','vCkIddrM','W5ZcMCkzWPRdIG','o2xdTG3cGt4','W6JcNCkCW5en','W7TTWQ7cIa','zcNcSmkYDa','WQ9NWQZcHSodq2SZv2G','xsBcSW','WP1hmuZdQa','cLJdP8obC8kPWQ0','W6fWWRtcN8ovfZaHx3C','tCk6C8kzz33cICkzWQ8','W57cKCkWW6e2','W7dcISksdHBdU8kGWOpdKNS','vCkWW5eDba','tCkXW54Ieq','xW3cVmkgyCkO','W6WUhCkGWPLoWRnaW7lcQG','6lEG5y+N5lMnsfjujrhdJMO','bNlcMCowWRi','qbRcNmkOCG','imoOuaG8sa','W60nmCkDWRC','WQHtlfLzCIaEW4q','FqFcHCkWyW','W57cIq7dSHO','bCoqW5qOWRu','dSk0WQ1dW6C','W6ddI8kksfyg','j8kpESoFoW','ASknlJ5H','WP0MWQShEwq','ACkMxeBdNa','ielcKmoesq','cghcMs5vimoKWRDXxa','W7ldVNNcIZC','o8oCW7uEWP8','W7PSWQ/cN8ohtMTNsg4','z8k/lbP3','tsZcSSk7W5i4W7dcTYGD','mmoeWPHlna','xqy5W63cSa','pgtcQSoiAa','omoDWPr6WR4','WP3dTxlcSCo+W4vSkmoofq','wG9IWQDF','WQpdP8khWRlcQG','WPXqyatcVq','W5v5WOj6zmkhbCoOW5xdLa','WQDGje8','imoIWR5Fma','hYZcUHhcOtevwxlcLa','W5DZWOzV','aqeVW7pcTmkUWO0','WRddNmorhre','rSk+lCk2WPy','saq6W6ZcSa','b8kYWOLXW5S','lvZcH8ogsa','k1BcPG','W7jsjI91yd54o8ot','vSkecWHS','WQ1PAgynW7iNja','W5tdQvVcRG','dxBdTSoHW7CQW4RcLv8D','nCo1WQbymG','wGtcVSkaoSo1W7T/eCoy','W55HW7GF','W4JcMCkg','W7FdG8kx','fqbSjCk0','EmkFf8kdWP4DW48','WOe3WQ0sDq','W5pdV03cQtJcMG','W5zLW6izmmk5','WRZdI8oSjX3cO8kc','yd/cVCkmuG','W4q5imouWRy','W7BcM8k4W7iY','W6ZcPSkCW6K7','WPb5WOrM','WPOGWRyqyZdcJmoHvSoc','ur3cOCkiE8kLWQy8','WQhdJ8opoHhcNSkvWP7dJWe','WRXjWPhdMS
|
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
|