jdpro/jd_farm_help.js

12 lines
131 KiB
JavaScript
Raw Normal View History

2024-06-28 07:47:44 +00:00
/*
东东农场助力
20 2,6,11 * * * jd_farm_help.js
updatetime:2023/10/29
变量
epxort FRUIT_DELAY='1000',设置等待时间(毫秒)默认请求5次接口等待5秒5000
export FRUITCODES='xxx&xxx' 指定助力码助力多个用&分割不指定则自动搜集任务助力码
*/
const $ = new Env('东东农场-助力');
2024-12-11 13:35:03 +00:00
var acid0Z,OjRVWd5,KefOw4Q,OsPbEVn,aTb4yED,PHaZD2,vmCiuGA,SINU8gi,YL1BtN,Bh5MiA,mnwRkd;const Qo0o1J=[0x0,0x1,0x8,0xff,"length","undefined",0x3f,0x6,"fromCodePoint",0x7,0xc,"push",0x5b,0x1fff,0x58,0xd,0xe,null,0x7f,0x80,0x2,0x3,!0x0,0x83,0x2000000,0x4000000,!0x1,0x91,0x92,0x97,0x99,0xa2,0xa3,0xa4,0xa6,0xa1,0xa5," ",0xb7,0x3ff,0x10000,0xa,0xd800,0xdc00,0x1f,0xf,0x12,0xc0,0xe0,0xf0,0xc3,0xdf,0xef,0xf5,0xf6,0xf8,0xf2,0xf7,0x4,0x100,"\n","\u52A9\u529B",0x108,0x7d0,"0",0x113,0x115,0x117,0x116,0x11e,0x11f,0x124,0x12c,0x12f,0x12d,0x10e,0x111,0x3c,0x3e8,0x13a,0x140,",",0x139,"\u6B21\n",0x14a,0x14b,0x148,0x15f,0x161,0x162,0x18,0x160,0x15b,0x93,0x5,0x17f,"UA",0x1b1,0x1c4,0x1c7,0x1c8,0x1c9,0x1c2,0x1d0,"-",0x1d1,0x1cd,0x1cc,0x1d3,0x1d4,"@",0xcb,0x1dd,0x1de,0x1e0,0x1df,0x1e5,0x1e8,0x1e9,0x1ea,"&",0x1ef,0x1ec,0x1ed,0x1ee,0x1f6,0x1d5,0x1cb,0x1e1,0x1fb,0x2710,0x201,"1",0x5dc,0x1da,0x213,0x1ca];function fcW9K4(acid0Z){var OjRVWd5="Pu){^!0xNrEQ=OqHIn4lbS:B,]Kh~Ge3kopW\"V<ya$F[7ZDYcj*>8v1g6Ct?R;5X|&+/`iTwf%AU@#.2MLJ(_}d9msz",KefOw4Q,OsPbEVn,aTb4yED,PHaZD2,vmCiuGA,SINU8gi,YL1BtN;lgbQSKu(KefOw4Q=""+(acid0Z||""),OsPbEVn=KefOw4Q.length,aTb4yED=[],PHaZD2=Qo0o1J[0x0],vmCiuGA=Qo0o1J[0x0],SINU8gi=-Qo0o1J[0x1]);for(YL1BtN=Qo0o1J[0x0];YL1BtN<OsPbEVn;YL1BtN++){var Bh5MiA=OjRVWd5.indexOf(KefOw4Q[YL1BtN]);if(Bh5MiA===-Qo0o1J[0x1])continue;if(SINU8gi<Qo0o1J[0x0]){SINU8gi=Bh5MiA}else{lgbQSKu(SINU8gi+=Bh5MiA*Qo0o1J[0xc],PHaZD2|=SINU8gi<<vmCiuGA,vmCiuGA+=(SINU8gi&Qo0o1J[0xd])>Qo0o1J[0xe]?Qo0o1J[0xf]:Qo0o1J[0x10]);do{lgbQSKu(aTb4yED.push(PHaZD2&Qo0o1J[0x3]),PHaZD2>>=Qo0o1J[0x2],vmCiuGA-=Qo0o1J[0x2])}while(vmCiuGA>Qo0o1J[0x9]);SINU8gi=-Qo0o1J[0x1]}}if(SINU8gi>-Qo0o1J[0x1]){aTb4yED.push((PHaZD2|SINU8gi<<vmCiuGA)&Qo0o1J[0x3])}return p_RVBkW(aTb4yED)}function ysFg8k(KefOw4Q){if(typeof acid0Z[KefOw4Q]===Qo0o1J[0x5]){return acid0Z[KefOw4Q]=fcW9K4(OjRVWd5[KefOw4Q])}return acid0Z[KefOw4Q]}lgbQSKu(acid0Z={},OjRVWd5=["!`#xwv!$.4tTMH%]","(ZiE.ZXB{=A:{*>p+>.jR_P","G=a1]C{UZS^r*]hnwBt>4.5M[&<","3rVE%RdDzq9uuIcav{QGn8IN^l1","M]VgCRd8oR@vWJ+\"*Z,.=","ta$0J8dp%tQEl)`4N^/kz?VlIrW@={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^G?pL$YHwMofrlg`)!gvk4CnBpoIXFA`B^","3[9@h<yx}tDq|HzW/1D@9(f,oC`]WKi3svx8Lggu","Q4w@Z;l$HHh","_098B@MAP+h>3*5n_cOE>Vt4c+14jI\"V@q9^0AvO.Q7M*Tq","ZV?vQi7en4V3IYXV_>6r!Rw$lR0&bhx<d?bASauWpRFxWJ:p9>8EVV1D+r>","c118Yj3X2XiMAT`,2nAkD`N8x","&%2jpaC$^","ICB0G(.=T|EI+VuV.ZAvrc_,~q}R3JJ~tci^rLnl0","]Avg:.SxA?_Hs,6Fru","cVvx2L`=&C9XM(&nV`H0S","Balkp;P","tc8gRvR)","*w{!>#3lqX/SNHdW!={!]%}G;qX%~{","4a/G2(?Oant?d]|G{1yeQd4tjCpEPHs$`P",")CB8!f(O`O>@f,5BLTU#5p&>I4\"c:!}WM3?v5ygu","|n2j9<X$&4axCI(~LVt><VqDwb>+^{^n","8r|rVW<eF?u.+O2h\"`cjii!iLHnb9qh$NwY8Q(#CIX/vSRr]UnM0Gad=^","Ywxe.guX0","FGgj>JixMH","9FM0uyP,t&m:+V7<r^Vxz@wC]t7qgqpn*Vj0Y;ct^","v>iK76uXLX#Dk{4yp`ZxL85DFQ63hq04qu","gaRAMwfeFq","Ow6>5vHO7SiMtix]d&^A62xljH*igq!e\"HWGnL0dVlQI)!f4nD1j~","RwnUK(BlYR%N^yda,wH0[U&W)=","d>*G]@0dO?&TAi<V\"G%>#clv7&S{5jIKhV60[J;Y(RMRm?0","[&Qf,.WYv|u1q;HKc3B8GMyLb|UA|{jaT1\"3Cvc)","ycR3Lo>u","9Z>Go}fDz?WfLM/nVc/#oMI89b~&\"(=",":=X@tpiO
2024-11-10 00:04:50 +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