jdpro/jd_global_task.js

6 lines
82 KiB
JavaScript
Raw Normal View History

2024-07-13 07:41:46 +00:00
/*
15 1 * * * jd_global_task.js
*/
const $ = new Env('京豆国际频道任务');
2024-07-23 03:30:24 +00:00
var _0xodU='jsjiami.com.v7';const _0x50ceae=_0x5dba;(function(_0x34d4cf,_0x41ab7f,_0x1f2666,_0x12d9e9,_0x3ecfef,_0x38c915,_0x2eab78){return _0x34d4cf=_0x34d4cf>>0x7,_0x38c915='hs',_0x2eab78='hs',function(_0x593ce7,_0x61bd35,_0x2f48d1,_0x27de12,_0x1c139c){const _0xb7da7a=_0x5dba;_0x27de12='tfi',_0x38c915=_0x27de12+_0x38c915,_0x1c139c='up',_0x2eab78+=_0x1c139c,_0x38c915=_0x2f48d1(_0x38c915),_0x2eab78=_0x2f48d1(_0x2eab78),_0x2f48d1=0x0;const _0x151477=_0x593ce7();while(!![]&&--_0x12d9e9+_0x61bd35){try{_0x27de12=-parseInt(_0xb7da7a(0x2d8,'Rz%9'))/0x1+-parseInt(_0xb7da7a(0x4c0,'lCj]'))/0x2+-parseInt(_0xb7da7a(0x4f6,'YcDQ'))/0x3*(parseInt(_0xb7da7a(0x583,'Qx$n'))/0x4)+parseInt(_0xb7da7a(0x59d,'pr&*'))/0x5+parseInt(_0xb7da7a(0x479,'iRd@'))/0x6+parseInt(_0xb7da7a(0x20c,'X38M'))/0x7*(parseInt(_0xb7da7a(0x40e,'Wl&D'))/0x8)+parseInt(_0xb7da7a(0x518,'c$Qq'))/0x9;}catch(_0x2944ab){_0x27de12=_0x2f48d1;}finally{_0x1c139c=_0x151477[_0x38c915]();if(_0x34d4cf<=_0x12d9e9)_0x2f48d1?_0x3ecfef?_0x27de12=_0x1c139c:_0x3ecfef=_0x1c139c:_0x2f48d1=_0x1c139c;else{if(_0x2f48d1==_0x3ecfef['replace'](/[hFbYkTyLPBNCxOSAMGQ=]/g,'')){if(_0x27de12===_0x61bd35){_0x151477['un'+_0x38c915](_0x1c139c);break;}_0x151477[_0x2eab78](_0x1c139c);}}}}}(_0x1f2666,_0x41ab7f,function(_0x256663,_0x2e3263,_0x43e20f,_0x48c047,_0x470035,_0x29e28d,_0x1ba409){return _0x2e3263='\x73\x70\x6c\x69\x74',_0x256663=arguments[0x0],_0x256663=_0x256663[_0x2e3263](''),_0x43e20f=`\x72\x65\x76\x65\x72\x73\x65`,_0x256663=_0x256663[_0x43e20f]('\x76'),_0x48c047=`\x6a\x6f\x69\x6e`,(0x17a4bf,_0x256663[_0x48c047](''));});}(0x6000,0x6c1dd,_0x829e,0xc2),_0x829e)&&(_0xodU=0xc2);const _0x3ce978=$[_0x50ceae(0x239,'iRd@')]()?require(_0x50ceae(0x273,'#m5H')):'',_0x60d2a0=$[_0x50ceae(0x2a1,'T^f[')]()?require(_0x50ceae(0x40a,'XuMD')):'',_0x399941=require(_0x50ceae(0x36d,'M[tz')),_0x48acf9=require(_0x50ceae(0x2e1,'qq!*')),_0x4cc94f=require(_0x50ceae(0x2bb,'Y*Jh')),_0x212a73=require(_0x50ceae(0x58b,'lCj]'));let _0x5b097f=!![],_0x124a2d=[],_0x81dd34='',_0x2a6d99='',_0x222cd5={};if(process[_0x50ceae(0x571,'ZRlO')][_0x50ceae(0x325,'K4yQ')]){const _0x2b31e3=process[_0x50ceae(0x3a1,'Y*Jh')][_0x50ceae(0x3fd,'38bF')]?(process[_0x50ceae(0x4c7,'K4yQ')][_0x50ceae(0x379,'H$CK')]+_0x50ceae(0x598,'AeLq'))[_0x50ceae(0x258,'iMBn')]('&'):'';if(_0x2b31e3=='')try{require(_0x50ceae(0x582,'iMBn')),_0x222cd5=require(_0x50ceae(0x3e0,'(*nY')),$[_0x50ceae(0x4ed,'Y*Jh')]=_0x222cd5[_0x50ceae(0x56c,'iMBn')]($[_0x50ceae(0x38e,'XuMD')][_0x50ceae(0x500,'tU!q')]($)),$[_0x50ceae(0x3d7,'pr&*')]=_0x222cd5[_0x50ceae(0x37e,'38bF')]($[_0x50ceae(0x323,'#m5H')][_0x50ceae(0x255,'Q$rC')]($));}catch{$[_0x50ceae(0x321,'H$CK')](_0x50ceae(0x3cc,'&rqY')),$[_0x50ceae(0x31a,'10l6')]=$[_0x50ceae(0x26e,'91pX')],$[_0x50ceae(0x451,'Rz%9')]=$[_0x50ceae(0x2d9,'Qx$n')];}else{if(_0x2b31e3[_0x50ceae(0x58f,'2&MF')](_0x4c4e39=>process[_0x50ceae(0x584,'4fV@')][_0x50ceae(0x37b,'iMBn')][_0x50ceae(0x52f,'10l6')](_0x4c4e39))[_0x50ceae(0x361,'FK5#')]!=0x0)try{require(_0x50ceae(0x3c6,'10l6')),_0x222cd5=require(_0x50ceae(0x55a,'p$vx')),$[_0x50ceae(0x3ec,')lMB')]=_0x222cd5[_0x50ceae(0x398,')1nr')]($[_0x50ceae(0x405,'W%UX')][_0x50ceae(0x269,'H$CK')]($)),$[_0x50ceae(0x3d7,'pr&*')]=_0x222cd5[_0x50ceae(0x2ca,'91pX')]($[_0x50ceae(0x28b,'Y*Jh')][_0x50ceae(0x44b,'xKrU')]($));}catch{$[_0x50ceae(0x4f2,'FK5#')](_0x50ceae(0x4b2,'91pX')),$[_0x50ceae(0x3ca,'(*nY')]=$[_0x50ceae(0x2b4,'AeLq')],$[_0x50ceae(0x231,'4fV@')]=$[_0x50ceae(0x4bf,'M[tz')];}else $[_0x50ceae(0x50a,'M[tz')]=$[_0x50ceae(0x2b9,'iRd@')],$[_0x50ceae(0x435,'pr&*')]=$[_0x50ceae(0x4a6,'iMBn')];}}else $[_0x50ceae(0x2ad,'Q$rC')]=$[_0x50ceae(0x2a0,'p$vx')],$[_0x50ceae(0x21d,'yR0O')]=$[_0x50ceae(0x51a,'Q$rC')];if($[_0x50ceae(0x2b2,'W%UX')]()){Object[_0x50ceae(0x351,'iRd@')](_0x60d2a0)[_0x50ceae(0x51c,'Wl&D')](_0x434f68=>{const _0x1d8b6b=_0x50ceae;_0x124a2d[_0x1d8b6b(0x23b,'pr&*')](_0x60d2a0[_0x434f68]);});if(process[_0x50ceae(0x3a1,'Y*Jh')][_0x50ceae(0x4dd,'q!0Z')]&&process[_0x50ceae(0x42a,')lMB')][_0x50ceae(0x2bd,')1nr')]===_0x50ceae(0x52e,'tTaN'))console[_0x50ceae(0x364,'M[tz')]=()=>{};}else _0x124a2d=[$[_0x50ceae(0x3ce,'t
2024-07-13 07:41:46 +00:00
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