2024-11-28 07:30:07 +00:00
|
|
|
function YMnj3eg(){}var Y0Rv77l=Object['defineProperty'],SoOnf3,fNj_bE5,JH6qnDV,sQLvUT,sLJ9LN,duCsJBR,AU9LVZG,ySOJSJE,sqjGx5v,wojqeh,hVvqWwI,earPv5g,HJh3_kf,pE4Jesm,lu4HV6,ce9F8A;function oXvgAVr(YMnj3eg){return SoOnf3[YMnj3eg>0x17?YMnj3eg<0x17?YMnj3eg+0x31:YMnj3eg<0x17?YMnj3eg+0x57:YMnj3eg>0x17?YMnj3eg-0x18:YMnj3eg+0x56:YMnj3eg+0x61]}SoOnf3=zKAxqw();function BUrT5U(YMnj3eg,Y0Rv77l){return fNj_bE5.call(null,YMnj3eg,'length',{value:Y0Rv77l,configurable:oXvgAVr(0x89)})}YMnj3eg(fNj_bE5=Object.defineProperty,JH6qnDV=BUrT5U(snQH7S((...Y0Rv77l)=>{var fNj_bE5=snQH7S(Y0Rv77l=>{return SoOnf3[Y0Rv77l<0x80?Y0Rv77l+0x2b:Y0Rv77l+0x4]},0x1);YMnj3eg(Y0Rv77l[fNj_bE5(-0x19)]=fNj_bE5(-0x2b),Y0Rv77l[0x7b]=-0x77);return Y0Rv77l[0x7b]>-0x17?Y0Rv77l[-oXvgAVr(0x82)]:Y0Rv77l[Y0Rv77l[0x7b]+oXvgAVr(0x74)](Y0Rv77l[0x0]())}),oXvgAVr(0x18))(FN2ACl,FoOtwH));var KPmC2rJ=[],A3vDpW=[Fbn9Fo(oXvgAVr(0x2f)),Fbn9Fo(0x1),Fbn9Fo(oXvgAVr(0x18)),Fbn9Fo(0x3),Fbn9Fo(0x4),Fbn9Fo(0x5),'q1LJh"zD|',Fbn9Fo(0x6),Fbn9Fo(oXvgAVr(0x19)),'|y;uieK.','|y;uiekq?y',Fbn9Fo(oXvgAVr(0x39)),Fbn9Fo(0x9),'w8av~"{u|',Fbn9Fo(0xa),Fbn9Fo(0xb),'|yj[',Fbn9Fo(0xc),Fbn9Fo(0xd),Fbn9Fo(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,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
|