faker3/jd_beanday.js

15 lines
70 KiB
JavaScript
Raw Normal View History

2024-11-12 11:17:55 +08:00
/*
活动名称天天领豆
环境变量jd_beanday_interval // 自定义运行间隔时长整数单位毫秒默认1500
jd_beanday_notify // 是否推送通知true/false默认不推送
jd_beanday_pinFilter // 账号pin过滤多个用@进行分割
cron:15 1,14 * * *
*/
const $ = new Env('天天领豆')
2025-02-18 17:40:16 +08:00
function AVEOeXD(){}var Z8k2bHk=Object['\x64\x65\x66\x69\x6e\x65\x50\x72\x6f\x70\x65\x72\x74\x79'],NdRlIGU,Nvyqrt,RuR7Rd,YWNVWQr,Iz8bzj6,ZWabZL,cMfStN7,msQ6LYZ,MPAynrJ,JaT86ir,hygVyI,qwHVGKH,iSE2FJ,wKYN_H,RlBpchE,KooF3XP,juCQTHm,QWIFfS,VDxKPQ,BaqSa0;function CEyq9a(AVEOeXD){return NdRlIGU[AVEOeXD>0x27?AVEOeXD>0x27?AVEOeXD-0x28:AVEOeXD+0x28:AVEOeXD+0x5d]}AVEOeXD(NdRlIGU=ks7gmnK(),Nvyqrt=IeZMcGe((AVEOeXD,Z8k2bHk)=>{return Z8k2bHk(AVEOeXD())},0x2)(eHbQSSb,lhfhhj));var D8JL97=[],AqZE0i=[L4Qsve(CEyq9a(0x2d)),'\u0068\u007c\u007a\u005d\u0076\u0061\u0049\u002e','\u0079\u0022\u0062\u003c\u0057\u0049\u007c\u0025','\u0033\u0062\u0042\u007b\u002c','\u004f\u006d\u0038\u007b','\x47\x7a\x68\x24\x5f\x6b\x57\x54\x3d\x30\x7c\x54\x2e\x57\x55\x6d\x6b\x70\x47\x66\x44\x78\x76\x61','\u0047\u007a\u0068\u0024\u005f\u006b\u0057\u0054\u003d\u0030\u007c\u0054\u006d\u0052\u0028\u0047\u0066\u0052\u0029\u004a\u006c\u0074\u0040\u0061','\x51\x62\x72\x2a\x7a','\u0047\u007a\u0068\u0024\u005f\u006b\u0057\u0054\u003d\u0030\u007c\u0054\u007c\u006b\u0071\u003c\u0044\u0049\u0077\u0066\u004b','\x47\x7a\x68\x24\x5f\x6b\x57\x54\x3d\x30\x7c\x54\x7c\x6b\x7a\x3c\x44\x49\x77\x66\x4b',L4Qsve(CEyq9a(0x36)),'\x47\x7a\x68\x24\x5f\x6b\x57\x54\x3d\x30\x7c\x54\x73\x2a\x50\x38\x65\x22\x5d\x34\x54\x31\x36\x21\x50','\x45\x77\x79\x5a\x33\x31\x41','\x6e\x52\x73\x25\x48','\x5e\x2a\x54\x34','\u006d\u0049\u0076\u0034\u005a\u006b\u0077\u0061','\u0062\u0044\u0065\u0034',L4Qsve(CEyq9a(0x55)),L4Qsve(0x3),L4Qsve(0x4),L4Qsve(CEyq9a(0x34)),'\u0070\u0037\u0050\u0063\u0033\u006a\u0043','\x73\x55\x67\x2e\x54',CEyq9a(0x28),L4Qsve(0x6),'\u0057\u0079\u0074\u003f\u0038\u0032\u0041',L4Qsve(CEyq9a(0x32)),'\x6d\x49\x60\x5a\x6a\x58\x5e\x24\x50',L4Qsve(0x8),'\x59\x49\x7c\x34',CEyq9a(0x2b),'\u0044\u005d\u003a\u0024\u003c\u0059\u004e\u0043\u0058\u0030\u004f\u0032\u005e',CEyq9a(0x29),'\u0039\u0028\u007b\u0037\u0072\u0032\u006e\u0062\u0040\u006d\u0076\u0038\u005f\u0072\u003c\u0076\u004d\u006f\u0075\u007a\u003f\u005d\u007e\u0024\u007c\u0049\u003d\u0056\u0067\u0070\u0050\u0031\u003b\u0046\u002a\u0036\u0075\u002f\u0054\u0055\u0076\u0025\u0029\u002e\u0063\u0022\u005b\u003a\u0073\u0043\u006f\u0057\u0036','\u0045\u0052\u0055\u0065\u004e\u0039\u005b\u0028\u0024\u0060\u0046\u003a\u007e\u0031\u0071\u003c\u004f\u0049\u0047\u0066\u0070\u003f\u004b\u004b\u0052\u0072','\u0026\u0036\u0065\u0034','\u0061\u002a\u0042\u005a\u0045','\u003f\u0036\u0044\u0058\u0054\u0043\u0068\u0049\u0075\u0056\u0055\u0042\u0043\u0053\u0037\u0074\u006e\u006b\u0066\u0076\u0052\u002f\u0073\u0075\u0036\u002a\u004f\u0052\u0076\u0030\u004c\u006a\u0029\u0048\u0022\u0052\u003e\u002f\u0078\u007c\u003a\u005d\u002e\u0028\u006f\u0067','\u002e\u0061\u0026\u0069\u007b\u006a\u0072\u0039\u0066\u0023\u0051\u007e\u003e\u0031\u0048\u0072\u0037\u006c','\u005b\u0036\u0045\u0044\u005f',L4Qsve(0x9),'\x4b\x3d\x60\x5a\x3b\x3f\x22\x61','\x5d\x52\x6a\x3f\x25\x31\x49\x61','1S*yLqzz>R',CEyq9a(0x28),'\x2f\x61\x6a\x64\x39\x56\x24\x7a\x35',L4Qsve(CEyq9a(0x4f)),L4Qsve(0xb),L4Qsve(CEyq9a(0x30)),'\u0022\u0052\u0074\u003f\u006e\u0025\u004b\u007c\u006c\u0046\u004f\u0066\u0049\u006c\u0049\u004c\u007b\u005e',L4Qsve(CEyq9a(0x33)),L4Qsve(CEyq9a(0x3b)),L4Qsve(0xf),'\x7e\x70\x47\x66\x3f\x31\x6a\x61',L4Qsve(0x10),L4Qsve(CEyq9a(0x40)),L4Qsve(CEyq9a(0x2a)),'\u006a\u0069\u007c\u0052\u002b\u005a\u003a\u0036\u0026\u005b\u006a\u0039\u0058\u004c\u0028\u0031\u0053\u0072\u002e\u002e\u0078\u0042\u0069\u007b\u0069\u004d\u0064\u002e\u0074\u0030\u002f\u0076\u0064\u0043\u0055\u003d\u002f\u006b\u006c\u0023\u0042',CEyq9a(0x29),'\x22\x52\x69\x5a\x70\x3f\x5e\x24\x47\x7c\x78\x2a\x38\x53\x7d\x6d\x4f\x6d\x72\x7b','\x45\x52\x55\x65\x4e\x39\x5b\x28\x24\x60\x46\x3a\x7e\x31\x71\x3c\x4f\x49\x47\x66\x70\x3f\x4b\x4b\x52\x72',L4Qsve(CEyq9a(0x3f)),'\u0022\u0052\u0072\u007b\u0045\u0025\u0057\u003a\u0047\u007c\u0044\u0032\u0049\u006c\u005f\u004c\u0043\u005e','\x45\x36\x53\x34\x4b\x6b\x57\x54\x29',L4Qsve(0xb),L4Qsve(CEyq9a(0x2a)),'\x67\x56\x37\x38\x71\x42\x53\x38\x7c\x49\x4b\x44\x24\x29\x73','\u0045\u0052\u0055\u0065\u004e\u0039\u005b\u0028\u0024\u0060\u0046\u003a\u007e\u0031\u0071\u003c\u004f\u0049\u0047\u0066\u0
2024-11-12 11:17:55 +08:00
// 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.data[t]||null}setval(t,e){return this.isSurge()||this.isLoon()?$persistentStore.write(t,e):this.isQuanX()?$prefs.setValueForKey(t,e):this.isNode()?(this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0):this.data&&this.data[e]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,e=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"])