jdpro/jd_health_collect.js

7 lines
76 KiB
JavaScript
Raw Normal View History

2024-06-28 07:47:44 +00:00
/*
东东健康社区收集能量收集能量(不做任务任务脚本请使用jd_health.js)
cron "5-45/20 1-5 * * *" script-path=jd_health_collect.js, tag=东东健康社区收集能量
*/
2024-11-02 01:10:57 +00:00
const $ = new Env('健康社区收集能量');
function aXGXs_G(){}var evZW7d1=Object['defineProperty'],jCrhGyB,B4K0y3,WvSxZmM,CiFnMY,Vd5Q81U,Kvq3UE,DpVE5Xd,lVBY3h,jTvY3N,IoLFBn_,DZJJcA,WBDx1d8,A7_koO,IvY8NMm,Qo7f5K9,pkwkRjA,MQ2FiP,LNCgT6r,xeMzOtf,vDkizsd,TpmhE3,w0dq7t5;function kjwu32(aXGXs_G){return jCrhGyB[aXGXs_G>0x81?aXGXs_G+0x40:aXGXs_G>-0x3b?aXGXs_G<0x81?aXGXs_G>-0x3b?aXGXs_G+0x3a:aXGXs_G+0x51:aXGXs_G-0x4:aXGXs_G-0x29]}jCrhGyB=JkSg0HB();function aIrVXTN(aXGXs_G,evZW7d1){var WvSxZmM=PVM8SmE(aXGXs_G=>{return jCrhGyB[aXGXs_G<0x77?aXGXs_G<0x77?aXGXs_G>0x77?aXGXs_G-0x5d:aXGXs_G>0x77?aXGXs_G-0x5f:aXGXs_G+0x44:aXGXs_G-0x32:aXGXs_G-0x54]},0x1);return B4K0y3(aXGXs_G,WvSxZmM(-0x44),{value:evZW7d1,configurable:kjwu32(-0x9)})}aXGXs_G(B4K0y3=Object.defineProperty,WvSxZmM=aIrVXTN(PVM8SmE((...evZW7d1)=>{var B4K0y3=PVM8SmE(evZW7d1=>{return jCrhGyB[evZW7d1>-0x3?evZW7d1>-0x3?evZW7d1<0xb9?evZW7d1+0x2:evZW7d1+0x55:evZW7d1+0x3e:evZW7d1-0x1b]},0x1);aXGXs_G(evZW7d1[B4K0y3(-0x2)]=0x2,evZW7d1[0x9c]=evZW7d1[B4K0y3(0x0)]);return evZW7d1[kjwu32(-0x29)](evZW7d1[kjwu32(-0x39)]())}),0x2)(INv0p6y,Ip9zI3y));var E5eOO7H=[],wzTOrX=[RrcWF_(kjwu32(-0x39)),RrcWF_(kjwu32(-0x38)),RrcWF_(kjwu32(-0x19)),RrcWF_(kjwu32(-0x1c)),RrcWF_(kjwu32(-0x36)),RrcWF_(kjwu32(-0x1b)),RrcWF_(0x6),RrcWF_(kjwu32(-0x23)),RrcWF_(kjwu32(-0x20)),RrcWF_(kjwu32(-0x1f)),RrcWF_(0xa),RrcWF_(0xb),'x;X{M7{T|_pgjl',RrcWF_(kjwu32(-0x2f)),RrcWF_(0xd),RrcWF_(0xe),RrcWF_(0xf),RrcWF_(kjwu32(-0x35)),RrcWF_(kjwu32(-0x5)),RrcWF_(0xb),RrcWF_(0xc),RrcWF_(kjwu32(-0x37)),RrcWF_(0xf),RrcWF_(kjwu32(-0x37)),RrcWF_(0xf),RrcWF_(kjwu32(-0x16)),RrcWF_(kjwu32(0x12)),RrcWF_(0x13),RrcWF_(0x14),'v|2jp','J~%R|+zx',RrcWF_(0x15),RrcWF_(0x10),RrcWF_(0x16),RrcWF_(0x17),RrcWF_(0x18),RrcWF_(0x19),RrcWF_(kjwu32(-0x2e)),RrcWF_(kjwu32(-0x3)),RrcWF_(0x1c),RrcWF_(0x1d),RrcWF_(kjwu32(-0x34)),RrcWF_(kjwu32(-0x2c)),RrcWF_(kjwu32(-0x2)),'V7:j]B8Yp6d)g}@Rd;Q(7P)9ewT+wm4SMd}i,{u$|^@.p29u[pr[?',RrcWF_(kjwu32(-0x33)),RrcWF_(kjwu32(-0x30)),RrcWF_(0x23),RrcWF_(kjwu32(-0x1)),RrcWF_(kjwu32(0x2)),RrcWF_(0x26),RrcWF_(kjwu32(0x3)),RrcWF_(kjwu32(0x0)),RrcWF_(kjwu32(-0x36)),RrcWF_(0x29),RrcWF_(kjwu32(0x6c)),RrcWF_(0x2b),RrcWF_(kjwu32(0x42)),RrcWF_(kjwu32(0x8)),RrcWF_(0x2e),RrcWF_(0x2f),RrcWF_(kjwu32(0x9)),RrcWF_(kjwu32(-0x35)),RrcWF_(kjwu32(-0x2b)),RrcWF_(kjwu32(-0x34)),RrcWF_(0x1f),RrcWF_(kjwu32(-0x33)),'V7:j]B8Yp6d)g}@Rd;Q(7P)9ewT+wm4SMd}i,{u$|^@.p29u[pr[?',RrcWF_(0x32),RrcWF_(0x33),RrcWF_(0x34),RrcWF_(0x35),RrcWF_(kjwu32(0xd)),RrcWF_(0x10),RrcWF_(0x1f),RrcWF_(kjwu32(0xb)),RrcWF_(0x38),RrcWF_(kjwu32(-0x31)),RrcWF_(kjwu32(-0x15)),'o|h{{Bw9Swb`okv5qm`6$B^9J^U^C89up~`{7nEqi^^x<?85H*g(uY:3le;xaR|5J7IgZr>u!]=,M}Y;am){&4qBrFMw7yYRU0%PcnKa',RrcWF_(0x3b),RrcWF_(0x3c),RrcWF_(kjwu32(0xc)),RrcWF_(0x3e),RrcWF_(0x3f),RrcWF_(0x40),RrcWF_(0x41),RrcWF_(0x42),RrcWF_(0x43),RrcWF_(kjwu32(0xf)),'Q7}i|{ba',RrcWF_(0x45),RrcWF_(kjwu32(0x51)),'6c*E*=P|',RrcWF_(0x47),RrcWF_(kjwu32(0x13)),RrcWF_(0x49),RrcWF_(0x4a),RrcWF_(0x4b),RrcWF_(kjwu32(0x14)),RrcWF_(kjwu32(-0x37)),'(RoE|NI|',RrcWF_(kjwu32(-0x32)),RrcWF_(kjwu32(-0x2d)),RrcWF_(0x4f),RrcWF_(0x50),RrcWF_(kjwu32(0x18)),RrcWF_(0x52),RrcWF_(0x53),RrcWF_(kjwu32(-0x32)),RrcWF_(0x54),RrcWF_(0x55),RrcWF_(0x4d),'ZD7h3s7|',RrcWF_(0x10),RrcWF_(kjwu32(0x1a)),RrcWF_(0x57),RrcWF_(kjwu32(-0x14)),RrcWF_(0x59),RrcWF_(kjwu32(0x15)),RrcWF_(0x5b),RrcWF_(0x5c),RrcWF_(kjwu32(0x1c)),RrcWF_(0x5e),RrcWF_(kjwu32(0x1d)),RrcWF_(0x60),RrcWF_(0x61),RrcWF_(0x62),RrcWF_(kjwu32(0x52)),RrcWF_(0x64),RrcWF_(0x65),RrcWF_(0x66),RrcWF_(0x67),RrcWF_(0x68),RrcWF_(kjwu32(0x1e)),RrcWF_(kjwu32(-0x31)),RrcWF_(0x6a),RrcWF_(kjwu32(0x20)),RrcWF_(0x3d),RrcWF_(kjwu32(0x56)),RrcWF_(0x6c),RrcWF_(0x6d),RrcWF_(0x6e),RrcWF_(0x6f),RrcWF_(kjwu32(0x21)),RrcWF_(0x71),RrcWF_(0x72),RrcWF_(0x73),RrcWF_(0x74),RrcWF_(kjwu32(-0x35)),RrcWF_(0x75),RrcWF_(0x76),RrcWF_(0x77),RrcWF_(kjwu32(0x19)),RrcWF_(0x78),RrcWF_(kjwu32(0x2e)),RrcWF_(kjwu32(0x2f)),RrcWF_(kjwu32(0x2b)),RrcWF_(kjwu32(0x30)),RrcWF_(kjwu32(0x31)),RrcWF_(kjwu32(0x32)),RrcWF_(0x39),RrcWF_(0x3a),RrcWF_(0x3b),RrcWF_(0x3c),RrcWF_(0x3d),RrcWF_(0x3e),RrcWF_(kjwu32(-0x22)),RrcWF_(0x7e),'{a!v0/O{AYUlk=<F}Y:|T&E6^Y8Mg#%PhW<dKBl*+',RrcWF_(0x7f),RrcWF_(0x4a),'|[uP4^p6
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