faker2/jd_XinFarm_water.js

19 lines
110 KiB
JavaScript
Raw Normal View History

2024-06-28 07:27:40 +00:00
/*
新东东农场指定浇水
浇水
环境变量
jd_XinFarm_waterpin // 指定浇水的账号填PIN值多个@隔开,不填则全部执行
jd_XinFarm_retainWater // 快速浇水,默认不开启(有水滴门槛,满足要求后开启才会生效)
jd_XinFarm_Notify // 是否推送通知true/false默认不推送
cron: 1 1 1 1 *
*/
const $ = new Env('新东东农场指定浇水')
var il='jsjiami.com.v7';const l111II=iii1II;(function(IlIiI1,ll1IIl,l11ll1,iIlllI,iIli1,iIllii,iIllil){return IlIiI1=IlIiI1>>0x3,iIllii='hs',iIllil='hs',function(l11lli,I1Il11,IlIiIl,iIiIll,iIlliI){const lI1i1I=iii1II;iIiIll='tfi',iIllii=iIiIll+iIllii,iIlliI='up',iIllil+=iIlliI,iIllii=IlIiIl(iIllii),iIllil=IlIiIl(iIllil),IlIiIl=0x0;const IlIiIi=l11lli();while(!![]&&--iIlllI+I1Il11){try{iIiIll=parseInt(lI1i1I(0x358,'YvT['))/0x1*(-parseInt(lI1i1I(0x4db,'SDRm'))/0x2)+parseInt(lI1i1I(0x587,'$[pe'))/0x3+-parseInt(lI1i1I(0x1f6,'3[P('))/0x4*(parseInt(lI1i1I(0x67f,'7KDK'))/0x5)+parseInt(lI1i1I(0x4b6,'sVyv'))/0x6+-parseInt(lI1i1I(0x496,'e8vh'))/0x7+parseInt(lI1i1I(0x2be,'M&ZI'))/0x8+parseInt(lI1i1I(0x527,'$[pe'))/0x9;}catch(IIlIi1){iIiIll=IlIiIl;}finally{iIlliI=IlIiIi[iIllii]();if(IlIiI1<=iIlllI)IlIiIl?iIli1?iIiIll=iIlliI:iIli1=iIlliI:IlIiIl=iIlliI;else{if(IlIiIl==iIli1['replace'](/[DMlxdgbpXrtqJkOFhLH=]/g,'')){if(iIiIll===I1Il11){IlIiIi['un'+iIllii](iIlliI);break;}IlIiIi[iIllil](iIlliI);}}}}}(l11ll1,ll1IIl,function(i1IIi1,IIlIiI,l11lll,i1iiI1,ll1l1I,iIilI1,i1IIiI){return IIlIiI='\x73\x70\x6c\x69\x74',i1IIi1=arguments[0x0],i1IIi1=i1IIi1[IIlIiI](''),l11lll=`\x72\x65\x76\x65\x72\x73\x65`,i1IIi1=i1IIi1[l11lll]('\x76'),i1iiI1=`\x6a\x6f\x69\x6e`,(0x171d2d,i1IIi1[i1iiI1](''));});}(0x640,0x965b2,Iii11l,0xca),Iii11l)&&(il=`\xf10`);const jdCookie=require(l111II(0x533,'3[P(')),notify=require(l111II(0x1c0,'SDRm')),common=require(l111II(0x2d3,'sk3Z')),{H5st}=require('./utils/Rebels_H'),CryptoJS=require(l111II(0x32e,'s!ET')),querystring=require('querystring'),pinFilterGoods=(process[l111II(0x1b6,'*()c')]['jd_XinFarm_waterpin']||'')['split']('@')[l111II(0x1ce,'JORS')](IIiI1l=>IIiI1l),retainWater=process['env'][l111II(0x3ad,'E43X')]===l111II(0x272,'OKQo'),isNotify=process[l111II(0x3bf,'3[P(')][l111II(0x51a,'U*BD')]==='true',sign_linkId=l111II(0x373,'sVyv'),draw_linkId=l111II(0x52d,'8)Fo');let pinMsg='';const award_map={0x1:'水滴',0x2:'水滴'};let cookie='';const cookiesArr=Object['keys'](jdCookie)[l111II(0x657,'jjBD')](IIiI1i=>jdCookie[IIiI1i])[l111II(0x1e3,'bmZ!')](ilIllI=>ilIllI);!cookiesArr[0x0]&&($[l111II(0x2f9,'N7qi')]($[l111II(0x279,'N8M#')],l111II(0x595,'s!ET')),process['exit'](0x1));!(async()=>{const IiIII1=l111II,I1IIli={'PzIEg':function(lIilI1,Il1I1l){return lIilI1<Il1I1l;},'AbgLY':IiIII1(0x23b,'U*BD'),'KqgvH':function(Ii1Il1,iIIIli){return Ii1Il1+iIIIli;},'XdHkR':IiIII1(0x1bf,'7KDK'),'bxEbD':function(I1IIll,i1Ii1){return I1IIll>i1Ii1;},'MEXdo':IiIII1(0x64d,'E!dX'),'uMoNc':'tYKNd','Vjrdr':function(lIilII){return lIilII();},'PbzZh':function(ilIlli,I1IIlI,ilIlll){return ilIlli(I1IIlI,ilIlll);},'mfGqT':function(Ii1Iii,Ii1Iil){return Ii1Iii*Ii1Iil;},'YalgM':function(ll1IiI,li1li){return ll1IiI===li1li;}};console[IiIII1(0x636,'*%VX')](IiIII1(0x29a,'N8M#')+$[IiIII1(0x279,'N8M#')]+IiIII1(0x60d,'6Ww$')),console[IiIII1(0x58a,'o!Dv')](IiIII1(0x62a,'E!dX')+(pinFilterGoods['length']?pinFilterGoods[IiIII1(0x606,'1%8L')](',\x20'):IiIII1(0x446,'oq)d'))+']'),console[IiIII1(0x336,'Y1!H')](IiIII1(0x5b1,'nI%t')+$['name']+IiIII1(0x2b6,'r1@Z')),notify[IiIII1(0x555,'jjBD')]({'title':$['name']});for(let iIIIll=0x0;I1IIli[IiIII1(0x4bb,'dyBK')](iIIIll,cookiesArr[IiIII1(0x5a1,'GI2f')]);iIIIll++){if(I1IIli[IiIII1(0x2d0,'Y1!H')]!==IiIII1(0x37b,'o!Dv')){$[IiIII1(0x348,'jjBD')]=I1IIli[IiIII1(0x563,'jjBD')](iIIIll,0x1),cookie=cookiesArr[iIIIll],common[IiIII1(0x63c,'U86E')](cookie),$[IiIII1(0x604,'wd^A')]=decodeURIComponent(common['getCookieValue'](cookie,IiIII1(0x5bd,'oKKl'))),$['UA']=common['genUA']($[IiIII1(0x201,'dyBK')]),$[IiIII1(0x17a,'jjBD')]=common[IiIII1(0x2fd,'oKKl')](I1IIli[IiIII1(0x22e,'oq)d')]),$[IiIII1(0x590,'jjBD')]=notify[IiIII1(0x326,'N8M#')]($[IiIII1(0x49a,'JI2I')],$[IiIII1(0x3fc,'60TV')]),$[IiIII1(0x26e,'1%8L')]='';if(pinFilterGoods&&I1IIli['bxEbD'](pinFilterGoods[IiIII1(0x1fc,'e8vh')],0x0)){if(I1IIli[IiIII1(0x5a6,'6Ww$')]===I1IIli['uMoNc'])l1iI1[lliiI1]?llIIi1[iI1IlI]=l1i1Il[ill1I1]:delete l1i1II[ili111];else{if(pinFilterGoods[IiIII1(0x4c7,'Fks2')](encodeURIComponent($['UserName'])))console[IiIII1(0x255,'1Ok5')](IiIII1(0x5d4,'6Ww$')+$[I
// prettier-ignore
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