jdpro/jd_farm_help.js

12 lines
125 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-11-10 00:04:50 +00:00
function PY5E9P(){}var yI6MVDP=Object['defineProperty'],_pyYSK,Darrp4,VmwdxK,MpsG243,c3Vp1_C,ExIhhyQ,dUAx7Rb,Kn5PUy,ilsjtK,ncUsuHw,mnTmGG,pWxaf2,IXAKfl,d273HhI,gha51Js,wzouVs,G9gRAL,ASQh0j,cKNmEK4;function jjWC8jP(PY5E9P){return _pyYSK[PY5E9P>0x1a4?PY5E9P-0x1d:PY5E9P>0x1a4?PY5E9P+0x61:PY5E9P-0x33]}_pyYSK=fjjtO23();function _T0w0_b(PY5E9P,yI6MVDP){var VmwdxK=dNaAiO(PY5E9P=>{return _pyYSK[PY5E9P>0x3a?PY5E9P<0x3a?PY5E9P-0x50:PY5E9P-0x3b:PY5E9P-0x35]},0x1);return Darrp4.call(null,PY5E9P,jjWC8jP(0x6a),{value:yI6MVDP,configurable:VmwdxK(0x8d)})}PY5E9P(Darrp4=Object.defineProperty,VmwdxK=dNaAiO((PY5E9P,yI6MVDP)=>{return yI6MVDP(PY5E9P())},0x2)(onqNB6,g5Cnns));var XvRLP9j=[],XbOiUZM=[Q7g4QAt(jjWC8jP(0x63)),Q7g4QAt(jjWC8jP(0x66)),Q7g4QAt(jjWC8jP(0x64)),Q7g4QAt(0x3),Q7g4QAt(0x4),Q7g4QAt(jjWC8jP(0x5e)),Q7g4QAt(jjWC8jP(0x74)),Q7g4QAt(0x7),Q7g4QAt(0x8),Q7g4QAt(0x9),Q7g4QAt(jjWC8jP(0x152)),Q7g4QAt(jjWC8jP(0x73)),Q7g4QAt(0xc),'Zw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{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