jdpro/jd_health_task.js

6 lines
81 KiB
JavaScript
Raw Normal View History

2024-06-28 07:47:44 +00:00
/*
2024-09-11 14:46:25 +00:00
12 3,15 * * * jd_health_task.js
2024-06-28 07:47:44 +00:00
*/
const $ = new Env('健康能量任务');
2024-11-28 07:30:07 +00:00
function vTE20O(){}var pr1pLff=Object['defineProperty'],SvcZAt,xIg_hC,aGmQohF,Ko21fP,dyZjnE,SFxjPj,YYP1iQ,oHZfWV,WVbk2l,y4V5NqT,ntKWEaA,IKAGi_J,jljGac;function RpGZFt9(vTE20O){return SvcZAt[vTE20O>0xf1?vTE20O+0x6:vTE20O<0xf1?vTE20O>0x50?vTE20O-0x51:vTE20O+0x46:vTE20O-0x2a]}SvcZAt=rYl6jZ();function ofskcoT(vTE20O,pr1pLff){return xIg_hC(vTE20O,'length',{value:pr1pLff,configurable:!0x0})}vTE20O(xIg_hC=Object.defineProperty,aGmQohF=ofskcoT(ExsepE((...pr1pLff)=>{var xIg_hC=ExsepE(pr1pLff=>{return SvcZAt[pr1pLff<0x9b?pr1pLff+0x5:pr1pLff+0x12]},0x1);vTE20O(pr1pLff[xIg_hC(0x10)]=0x2,pr1pLff[RpGZFt9(0x51)]=xIg_hC(0x6c));return pr1pLff[pr1pLff[xIg_hC(-0x5)]-RpGZFt9(0x58)]>RpGZFt9(0x5e)?pr1pLff[0xae]:pr1pLff[0x1](pr1pLff[pr1pLff[0x29]-0x82]())}),RpGZFt9(0x52))(iKv66M,Iqfmdy));var XufQDq=[],rIv58ML=[_O_C6RL(RpGZFt9(0x61)),_O_C6RL(0x1),_O_C6RL(RpGZFt9(0x52)),_O_C6RL(0x3),_O_C6RL(0x4),_O_C6RL(0x5),_O_C6RL(0x6),_O_C6RL(0x7),_O_C6RL(0x8),_O_C6RL(0x9),_O_C6RL(RpGZFt9(0x88)),_O_C6RL(0xb),_O_C6RL(0xc),_O_C6RL(0xd),_O_C6RL(RpGZFt9(0x56)),_O_C6RL(0xf),_O_C6RL(0x10),_O_C6RL(0x11),_O_C6RL(0x12),_O_C6RL(0x13),_O_C6RL(RpGZFt9(0x95)),_O_C6RL(0x15),'6B9xA|VUX',_O_C6RL(0x16),'Vr>~b!|y',_O_C6RL(0x17),_O_C6RL(0x18),'|e*UCNBy',_O_C6RL(0x19),_O_C6RL(0x1a),_O_C6RL(0x1b),_O_C6RL(RpGZFt9(0x94)),_O_C6RL(0x1d),_O_C6RL(0x1e),_O_C6RL(0x1f),'`!7B}U}sC&_|R',_O_C6RL(0x20),_O_C6RL(0x21),_O_C6RL(0x22),_O_C6RL(0x23),_O_C6RL(RpGZFt9(0x99)),_O_C6RL(0x25),_O_C6RL(0x26),_O_C6RL(0x27),_O_C6RL(0x28),_O_C6RL(0x29),_O_C6RL(0x20),_O_C6RL(RpGZFt9(0x9c)),_O_C6RL(RpGZFt9(0x54)),_O_C6RL(0x2c),_O_C6RL(0x2d),_O_C6RL(0x2e),_O_C6RL(0x2f),_O_C6RL(0x30),_O_C6RL(0x31),'?/|lu',_O_C6RL(0x32),_O_C6RL(0x33),'|uXFT,Jy',_O_C6RL(0x34),_O_C6RL(0x35),_O_C6RL(0x36),_O_C6RL(RpGZFt9(0xa5)),'AmUA|wQ4',_O_C6RL(RpGZFt9(0xa8)),_O_C6RL(0x39),_O_C6RL(0x3a),_O_C6RL(0x3b),_O_C6RL(0x3c),_O_C6RL(RpGZFt9(0x53)),_O_C6RL(RpGZFt9(0xab)),_O_C6RL(0x3f),_O_C6RL(0x40),_O_C6RL(0x2b),_O_C6RL(0x30),_O_C6RL(0x41),_O_C6RL(0x42),'?/|lu',_O_C6RL(RpGZFt9(0xa2)),_O_C6RL(0x33),RpGZFt9(0x55),'&#]r$!|y',_O_C6RL(0x44),_O_C6RL(0x45),_O_C6RL(0x46),_O_C6RL(0x47),_O_C6RL(RpGZFt9(0x5c)),_O_C6RL(RpGZFt9(0xdd)),_O_C6RL(0x3a),_O_C6RL(RpGZFt9(0x6d)),_O_C6RL(0x4a),_O_C6RL(RpGZFt9(0x53)),'|eZ9.9eywmcA;d_f@eOBwaEUTw5M|v%+4"{BS!hP~.NYsd',_O_C6RL(0x3f),_O_C6RL(RpGZFt9(0x54)),_O_C6RL(0x2d),_O_C6RL(RpGZFt9(0x96)),_O_C6RL(0x4b),_O_C6RL(0x32),_O_C6RL(0x4c),RpGZFt9(0x55),_O_C6RL(0x4d),_O_C6RL(RpGZFt9(0xad)),_O_C6RL(0x4e),_O_C6RL(0x3a),_O_C6RL(RpGZFt9(0xb1)),_O_C6RL(0x50),_O_C6RL(0x51),_O_C6RL(0x52),_O_C6RL(RpGZFt9(0xb2)),'a.E|mN*O@VG.d',_O_C6RL(0x54),'vFNz|j_4I&.3et`',_O_C6RL(0x55),_O_C6RL(RpGZFt9(0x5b)),_O_C6RL(0x57),_O_C6RL(RpGZFt9(0x82)),_O_C6RL(RpGZFt9(0x8f)),_O_C6RL(RpGZFt9(0xee)),_O_C6RL(0x59),_O_C6RL(0x5a),_O_C6RL(0x30),'|e#Up&o',_O_C6RL(0x5b),'?/|lu',_O_C6RL(0x5c),_O_C6RL(0x43),_O_C6RL(0x33),'|uXFT,Jy',_O_C6RL(0x5d),_O_C6RL(0x44),_O_C6RL(0x4a),_O_C6RL(0x53),_O_C6RL(RpGZFt9(0x5a)),_O_C6RL(RpGZFt9(0x59)),_O_C6RL(0x60),_O_C6RL(RpGZFt9(0x89)),_O_C6RL(0x10),_O_C6RL(0x61),_O_C6RL(0x20),_O_C6RL(0x62),'&#1rK2f,GZ#9w|b',_O_C6RL(0x62),_O_C6RL(RpGZFt9(0x57)),_O_C6RL(RpGZFt9(0xa6)),'<cc/|sdYigWaV>;',_O_C6RL(0x62),_O_C6RL(0x64),_O_C6RL(0x65),_O_C6RL(0x9),_O_C6RL(0x66),_O_C6RL(0x67),_O_C6RL(0x68),_O_C6RL(0x69),_O_C6RL(0x12),_O_C6RL(0x6a),_O_C6RL(RpGZFt9(0x5d)),_O_C6RL(RpGZFt9(0x8c)),_O_C6RL(0xa),_O_C6RL(0x6d),'01|wSkA@i+@nYL4YtVSwTPv@dN(LAW1>,dd',_O_C6RL(0x6e),_O_C6RL(0x6f),'xsa|hS!1dNE~B;g,:YsmAu2k]H',_O_C6RL(0x70),_O_C6RL(0x3d),_O_C6RL(0x71),'|eZ9=9zy',_O_C6RL(0x72),_O_C6RL(0x73),_O_C6RL(0x74),_O_C6RL(RpGZFt9(0xc0)),_O_C6RL(0x76),_O_C6RL(0x77),_O_C6RL(0x3f),'@Ni:]h(l<B9Lb*2,IIi^=Up{|(WxZc',_O_C6RL(0x78),_O_C6RL(0x79),'@jhCe|tG',_O_C6RL(0x7a),_O_C6RL(0x7b),_O_C6RL(0x7c),_O_C6RL(0x7d),_O_C6RL(0x7e),_O_C6RL(0x18),_O_C6RL(RpGZFt9(0xc1)),_O_C6RL(0x80),_O_C6RL(0x81),_O_C6RL(0x82),_O_C6RL(RpGZFt9(0x56)),_O_C6RL(0x21),_O_C6RL(0x83),_O_C6RL(0x84),_O_C6RL(0x85),_O_C6RL(0x86),_O_C6RL(0x87),_O_C6RL(0x88),'T+>~gk|PF;X*sd',_O_C6RL(0x64),_O_C6RL(0x89),_O_C6RL(RpGZFt9(0xc3)),_O_C6RL(0x8b),_O_C6RL(RpGZFt9(0x57)),_O_C6RL(0x2f),_O_C6RL(RpGZFt9(0xc5)),_O_C6RL(0x8d),_O
2024-09-11 14:46:25 +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