jdpro/jd_fruit.js

18 lines
237 KiB
JavaScript
Raw Normal View History

2024-06-28 07:47:44 +00:00
/*
更新时间2023-9-8
活动入口京东APP我的--东东农场
==========================Quantumultx=========================
[task_local]
#jd免费水果
15 3,13,18 * * * jd_fruit.js, tag=东东农场, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jdnc.png, enabled=true
变量
export NO_WATER='true' 完全不浇水浇水任务不做了
export FRUIT_PIN='pin1&pin2' 不浇水的pin多个&分隔使用pin控制就不要使用NO_WATER
export DO_TEN_WATER_AGAIN='true' 攒水滴只交10次水默认不攒水滴
export FRUIT_FAST_CARD='true' 使用快速浇水卡水多可开启
epxort FRUIT_DELAY='1000',设置等待时间(毫秒)默认请求5次接口等待5秒5000
*/
const $ = new Env('东东农场-任务');
var _0xode='jsjiami.com.v7';function _0xc15b(_0x23829e,_0x140f2b){const _0x5139db=_0x1ee6();return _0xc15b=function(_0x40af6c,_0x3356c2){_0x40af6c=_0x40af6c-0x184;let _0x1ee627=_0x5139db[_0x40af6c];if(_0xc15b['ZFDuUU']===undefined){var _0xc15b93=function(_0x1073db){const _0x272ec2='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x2f3552='',_0x5d467e='',_0x3855e=_0x2f3552+_0xc15b93;for(let _0x22c1ec=0x0,_0x21f964,_0x4e6e18,_0x1943a4=0x0;_0x4e6e18=_0x1073db['charAt'](_0x1943a4++);~_0x4e6e18&&(_0x21f964=_0x22c1ec%0x4?_0x21f964*0x40+_0x4e6e18:_0x4e6e18,_0x22c1ec++%0x4)?_0x2f3552+=_0x3855e['charCodeAt'](_0x1943a4+0xa)-0xa!==0x0?String['fromCharCode'](0xff&_0x21f964>>(-0x2*_0x22c1ec&0x6)):_0x22c1ec:0x0){_0x4e6e18=_0x272ec2['indexOf'](_0x4e6e18);}for(let _0x150eea=0x0,_0x38cd02=_0x2f3552['length'];_0x150eea<_0x38cd02;_0x150eea++){_0x5d467e+='%'+('00'+_0x2f3552['charCodeAt'](_0x150eea)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x5d467e);};const _0x391860=function(_0x5a9d86,_0x30e70f){let _0x31eb86=[],_0x21efeb=0x0,_0x31848a,_0x494288='';_0x5a9d86=_0xc15b93(_0x5a9d86);let _0x517a24;for(_0x517a24=0x0;_0x517a24<0x100;_0x517a24++){_0x31eb86[_0x517a24]=_0x517a24;}for(_0x517a24=0x0;_0x517a24<0x100;_0x517a24++){_0x21efeb=(_0x21efeb+_0x31eb86[_0x517a24]+_0x30e70f['charCodeAt'](_0x517a24%_0x30e70f['length']))%0x100,_0x31848a=_0x31eb86[_0x517a24],_0x31eb86[_0x517a24]=_0x31eb86[_0x21efeb],_0x31eb86[_0x21efeb]=_0x31848a;}_0x517a24=0x0,_0x21efeb=0x0;for(let _0x284721=0x0;_0x284721<_0x5a9d86['length'];_0x284721++){_0x517a24=(_0x517a24+0x1)%0x100,_0x21efeb=(_0x21efeb+_0x31eb86[_0x517a24])%0x100,_0x31848a=_0x31eb86[_0x517a24],_0x31eb86[_0x517a24]=_0x31eb86[_0x21efeb],_0x31eb86[_0x21efeb]=_0x31848a,_0x494288+=String['fromCharCode'](_0x5a9d86['charCodeAt'](_0x284721)^_0x31eb86[(_0x31eb86[_0x517a24]+_0x31eb86[_0x21efeb])%0x100]);}return _0x494288;};_0xc15b['zyzAKc']=_0x391860,_0x23829e=arguments,_0xc15b['ZFDuUU']=!![];}const _0x554230=_0x5139db[0x0],_0x22b64a=_0x40af6c+_0x554230,_0x35442a=_0x23829e[_0x22b64a];if(!_0x35442a){if(_0xc15b['xCfEJD']===undefined){const _0x225f5d=function(_0x28d9ac){this['VRzJYV']=_0x28d9ac,this['rsBYOK']=[0x1,0x0,0x0],this['BXJalG']=function(){return'newState';},this['oAQrxQ']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['RrceHn']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x225f5d['prototype']['DIbvtg']=function(){const _0x2e2f81=new RegExp(this['oAQrxQ']+this['RrceHn']),_0x9ec813=_0x2e2f81['test'](this['BXJalG']['toString']())?--this['rsBYOK'][0x1]:--this['rsBYOK'][0x0];return this['EIZdVC'](_0x9ec813);},_0x225f5d['prototype']['EIZdVC']=function(_0x1e90ea){if(!Boolean(~_0x1e90ea))return _0x1e90ea;return this['QJvurq'](this['VRzJYV']);},_0x225f5d['prototype']['QJvurq']=function(_0x42379e){for(let _0x485583=0x0,_0x138fd0=this['rsBYOK']['length'];_0x485583<_0x138fd0;_0x485583++){this['rsBYOK']['push'](Math['round'](Math['random']())),_0x138fd0=this['rsBYOK']['length'];}return _0x42379e(this['rsBYOK'][0x0]);},new _0x225f5d(_0xc15b)['DIbvtg'](),_0xc15b['xCfEJD']=!![];}_0x1ee627=_0xc15b['zyzAKc'](_0x1ee627,_0x3356c2),_0x23829e[_0x22b64a]=_0x1ee627;}else _0x1ee627=_0x35442a;return _0x1ee627;},_0xc15b(_0x23829e,_0x140f2b);}const _0x58fed5=_0xc15b;(function(_0x2a95a7,_0x1e29ff,_0x987859,_0x58a7aa,_0x2ebb54,_0x4c23b1,_0x5f5dea){return _0x2a95a7=_0x2a95a7>>0x4,_0x4c23b1='hs',_0x5f5dea='hs',function(_0x5da105,_0x32cfc0,_0x3e31ec,_0x18e0e6,_0x5913fb){const _0x52fcf1=_0xc15b;_0x18e0e6='tfi',_0x4c23b1=_0x18e0e6+_0x4c23b1,_0x5913fb='up',_0x5f5dea+=_0x5913fb,_0x4c23b1=_0x3e31ec(_0x4c23b1),_0x5f5dea=_0x3e31ec(_0x5f5dea),_0x3e31ec=0x0;const _0x32323a=_0x5da105();while(!![]&&--_0x58a7aa+_0x32cfc0){try{_0x18e0e6=-parseInt(_0x52fcf1(0x67d,'r#zm'))/0x1*(parseInt(_0x52fcf1(0x55e,'R0vZ'))/0x2)+-parseInt(_0x52fcf1(0x98c,'[ixF'))/0x3*(parseInt(_0x52fcf1(0x40c,'YBz3'))/0x4)+-parseInt(_0x52fcf1(0xadd,'of!$'))/0x5*(parseInt(_0x52fcf1(0x58d,'m]ns'))/0x6)+parseInt(_0x52fcf1(0x2b2,'F0d)'))/0x7*(parseInt(_0x52fcf1(0xba3,'V!7T'))/0x8)+-parseInt(_0x52fcf1(0x523,'[ixF'))/0x9+parseInt(_0x52fcf1(0x4d3,'m]ns'))/0xa+
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||"{}":"{}";try{const e=JSON.parse(a);this.lodash_set(e,i,t),s=this.setval(JSON.stringify(e),r)}catch(e){this.lodash_set(a={},i,t),s=this.setval(JSON.stringify(a),r)}}else s=this.setval(t,e);return s}getval(t){switch(this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":return $persistentStore.read(t);case"Quantumult X":return $prefs.valueForKey(t);case"Node.js":return this.data=this.loaddata(),this.data[t];default:return this.data&&this.data[t]||null}}setval(t,e){switch(this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":return $persistentStore.write(t,e);case"Quantumult X":return $prefs.setValueF