jdpro/jd_fruit.js

18 lines
233 KiB
JavaScript
Raw Permalink 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('东东农场-任务');
2024-07-09 02:18:43 +00:00
var _0xodB='jsjiami.com.v7';const _0x13b888=_0x4063;function _0x4063(_0xd4651b,_0x417126){const _0x2d3233=_0xed27();return _0x4063=function(_0x48dc25,_0x5c79d8){_0x48dc25=_0x48dc25-0x13f;let _0xed2750=_0x2d3233[_0x48dc25];if(_0x4063['GTqNij']===undefined){var _0x406326=function(_0x485ec6){const _0x19b2a9='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x2ba86b='',_0x359f1a='',_0x15d1b3=_0x2ba86b+_0x406326;for(let _0x32f7ea=0x0,_0x50a556,_0x18b0c7,_0x1655ab=0x0;_0x18b0c7=_0x485ec6['charAt'](_0x1655ab++);~_0x18b0c7&&(_0x50a556=_0x32f7ea%0x4?_0x50a556*0x40+_0x18b0c7:_0x18b0c7,_0x32f7ea++%0x4)?_0x2ba86b+=_0x15d1b3['charCodeAt'](_0x1655ab+0xa)-0xa!==0x0?String['fromCharCode'](0xff&_0x50a556>>(-0x2*_0x32f7ea&0x6)):_0x32f7ea:0x0){_0x18b0c7=_0x19b2a9['indexOf'](_0x18b0c7);}for(let _0x429b65=0x0,_0x415d20=_0x2ba86b['length'];_0x429b65<_0x415d20;_0x429b65++){_0x359f1a+='%'+('00'+_0x2ba86b['charCodeAt'](_0x429b65)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x359f1a);};const _0x373f92=function(_0x371670,_0x19aad5){let _0x400d14=[],_0x5349ef=0x0,_0x42b6ef,_0x135169='';_0x371670=_0x406326(_0x371670);let _0x185f83;for(_0x185f83=0x0;_0x185f83<0x100;_0x185f83++){_0x400d14[_0x185f83]=_0x185f83;}for(_0x185f83=0x0;_0x185f83<0x100;_0x185f83++){_0x5349ef=(_0x5349ef+_0x400d14[_0x185f83]+_0x19aad5['charCodeAt'](_0x185f83%_0x19aad5['length']))%0x100,_0x42b6ef=_0x400d14[_0x185f83],_0x400d14[_0x185f83]=_0x400d14[_0x5349ef],_0x400d14[_0x5349ef]=_0x42b6ef;}_0x185f83=0x0,_0x5349ef=0x0;for(let _0x424b98=0x0;_0x424b98<_0x371670['length'];_0x424b98++){_0x185f83=(_0x185f83+0x1)%0x100,_0x5349ef=(_0x5349ef+_0x400d14[_0x185f83])%0x100,_0x42b6ef=_0x400d14[_0x185f83],_0x400d14[_0x185f83]=_0x400d14[_0x5349ef],_0x400d14[_0x5349ef]=_0x42b6ef,_0x135169+=String['fromCharCode'](_0x371670['charCodeAt'](_0x424b98)^_0x400d14[(_0x400d14[_0x185f83]+_0x400d14[_0x5349ef])%0x100]);}return _0x135169;};_0x4063['jBlpja']=_0x373f92,_0xd4651b=arguments,_0x4063['GTqNij']=!![];}const _0x4f5057=_0x2d3233[0x0],_0x65706b=_0x48dc25+_0x4f5057,_0x251b68=_0xd4651b[_0x65706b];if(!_0x251b68){if(_0x4063['KPPXIP']===undefined){const _0x4b69be=function(_0x2a604e){this['aMJPji']=_0x2a604e,this['dGpOiA']=[0x1,0x0,0x0],this['LDvTTm']=function(){return'newState';},this['pKRzXw']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['TCgYNK']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x4b69be['prototype']['cwTzkI']=function(){const _0x11900b=new RegExp(this['pKRzXw']+this['TCgYNK']),_0x3dbbf4=_0x11900b['test'](this['LDvTTm']['toString']())?--this['dGpOiA'][0x1]:--this['dGpOiA'][0x0];return this['kgffwL'](_0x3dbbf4);},_0x4b69be['prototype']['kgffwL']=function(_0xce3b00){if(!Boolean(~_0xce3b00))return _0xce3b00;return this['SMzQNp'](this['aMJPji']);},_0x4b69be['prototype']['SMzQNp']=function(_0x22b627){for(let _0x478268=0x0,_0x2ed096=this['dGpOiA']['length'];_0x478268<_0x2ed096;_0x478268++){this['dGpOiA']['push'](Math['round'](Math['random']())),_0x2ed096=this['dGpOiA']['length'];}return _0x22b627(this['dGpOiA'][0x0]);},new _0x4b69be(_0x4063)['cwTzkI'](),_0x4063['KPPXIP']=!![];}_0xed2750=_0x4063['jBlpja'](_0xed2750,_0x5c79d8),_0xd4651b[_0x65706b]=_0xed2750;}else _0xed2750=_0x251b68;return _0xed2750;},_0x4063(_0xd4651b,_0x417126);}if(function(_0x9d4b11,_0x30d501,_0x10d730,_0x3d25b1,_0x4cc44a,_0x296409,_0x1157eb){return _0x9d4b11=_0x9d4b11>>0x4,_0x296409='hs',_0x1157eb='hs',function(_0x55e1de,_0x4f2f46,_0xe9aeb,_0x287930,_0xf7e684){const _0x36ec05=_0x4063;_0x287930='tfi',_0x296409=_0x287930+_0x296409,_0xf7e684='up',_0x1157eb+=_0xf7e684,_0x296409=_0xe9aeb(_0x296409),_0x1157eb=_0xe9aeb(_0x1157eb),_0xe9aeb=0x0;const _0x18c29e=_0x55e1de();while(!![]&&--_0x3d25b1+_0x4f2f46){try{_0x287930=-parseInt(_0x36ec05(0x76c,'I0I('))/0x1*(parseInt(_0x36ec05(0x92b,'I0I('))/0x2)+-parseInt(_0x36ec05(0x82a,'a2HV'))/0x3*(parseInt(_0x36ec05(0xbbe,'RWVp'))/0x4)+-parseInt(_0x36ec05(0xa97,'GTJh'))/0x5+parseInt(_0x36ec05(0x16d,'GYeN'))/0x6+parseInt(_0x36ec05(0x261,'HMrc'))/0x7+-parseInt(_0x36ec05(0x84c,'csm4'))/0x8+parseInt(_0x36ec05(0x595,'13w2'))/0x9;}catch(_0x41d023){_0x287930=_0xe9aeb;}fina
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||"{}":"{}";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