jdpro/jd_book_draw.js

7 lines
90 KiB
JavaScript
Raw Normal View History

2024-11-16 12:13:00 +00:00
/*
1 1 * * * jd_book_draw.js
*/
const $ = new Env('图书抽奖');
2024-11-26 04:35:52 +00:00
function FpRjkmO(){}var yK3GquU=Object['defineProperty'],BRSJat,kk0Ey1o,Sx7u6zd,Cb3gzB,q1wryE,P9pEkp,wZbRlS,kvd63_a,eSvtCA,z0mH4Ow,GVwFN0,KxBjlN3,vz2_zcl,CBOBnd,ECGjz_t,vZAycxz,NtuSEd,_2dAm8i,ib5Hou,jxxgYvo,v8OV4v;function ZKJ78XA(FpRjkmO){return BRSJat[FpRjkmO>0x33?FpRjkmO>0x33?FpRjkmO<0xa5?FpRjkmO<0x33?FpRjkmO-0x5d:FpRjkmO-0x34:FpRjkmO-0xd:FpRjkmO+0x24:FpRjkmO-0x4d]}BRSJat=f0KhQb();function qTCycuI(FpRjkmO,yK3GquU){return kk0Ey1o(FpRjkmO,'length',{value:yK3GquU,configurable:!0x0})}FpRjkmO(kk0Ey1o=Object.defineProperty,Sx7u6zd=qTCycuI(nGECCDe((...yK3GquU)=>{var kk0Ey1o=nGECCDe(yK3GquU=>{return BRSJat[yK3GquU>-0x37?yK3GquU>-0x37?yK3GquU+0x36:yK3GquU+0x2:yK3GquU-0x56]},0x1);FpRjkmO(yK3GquU.length=0x2,yK3GquU[0xbc]=0xf);if(yK3GquU[0xbc]>yK3GquU[0xbc]+kk0Ey1o(-0x36)){var Sx7u6zd=nGECCDe(yK3GquU=>{return BRSJat[yK3GquU>0x7d?yK3GquU-0x4f:yK3GquU<0x7d?yK3GquU-0xc:yK3GquU+0x9]},0x1);return yK3GquU[yK3GquU[0xbc]-Sx7u6zd(0xf)]}else{return yK3GquU[yK3GquU[0xbc]-0xe](yK3GquU[0x0]())}}),0x2)(KKU0hT,zg1H1XF));var Z8i9TH=[],Y_FYAr=[V5Zb1A(0x0),V5Zb1A(0x1),V5Zb1A(ZKJ78XA(0x40)),V5Zb1A(ZKJ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a),V5Zb1A(0x7b),V5Zb1A(0x3c),V5Zb1A(0x7c),V5Zb1A(ZKJ78XA(0x39)),V5Zb1A(0x17),V5Zb1A(0x7d),V5Zb1A(0x7e),V5Zb1A(0x3c),V5Zb1A(ZKJ78XA(0x3d)),V5Zb1A(0x7f),V5Zb1A(0x63),V5Zb1A(0x64),V5Zb1A(ZKJ78XA(0x34)),'LXrlt#|','"/OkzC|',V5Zb1A(0x81),V5Zb1A(0x82),V5Zb1A(ZKJ78XA(0x75)),V5Zb1A(0x84),V5Zb1A(0x85),'LXrl^#|',V5Zb1A(0x6b),V5Zb1A(0x6c),'|FPykxXA',V5Zb1A(0x86),'cXil%~|',V5Zb1A(0x87),V5Zb1A(0x88),V5Zb1A(0x72),V5Zb1A(ZKJ78XA(0x77)),V5Zb1A(0x73),V5Zb1A(0x8a),V5Zb1A(0x8b),V5Zb1A(0x25),V5Zb1A(0x76),V5Zb1A(0x52),V5Zb1A(ZKJ78XA(0x35)),V5Zb1A(0x8c),'FFfwk"|',V5Zb1A(0x8d),V5Zb1A(0x79),V5Zb1A(0x58),V5Zb1A(0x8e),V5Zb1A(0x3c),V5Zb1A(0x2b),V5Zb1A(ZKJ78XA(0x3a)),V5Zb1A(0x8f),V5Zb1A(0x69),V5Zb1A(0x90),V5Zb1A(0x91),V5Zb1A(0x92),V5Zb1A(0x93),V5Zb1A(0x94),V5Zb1A(0x95),V5Zb1A(0x96),V5Zb1A(0x97),V5Zb1A(0x98),V5Zb1A(ZKJ78XA(0x7a)),V5Zb1A(0x9a),V5Zb1A(0x13),V5Zb1A(0x25),V5Zb1A(0x3c),V5Zb1A(0x9b),V5Zb1A(0x9c),V5Zb1A(0x78),V5Zb1
2024-11-16 12:13:00 +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