2025-01-03 11:12:20 +08:00
|
|
|
var i8hFaM,kma557f,Lfbh0gW,pevBpX,XCMuGL,K0bQYf,yo4YyF,Rd0ABw2,G2gFKA,vVefPS,fmzahj;function V1IS1w(i8hFaM,kma557f,Lfbh0gW){for(Lfbh0gW=0x0;Lfbh0gW<kma557f;Lfbh0gW++)i8hFaM.push(i8hFaM.shift());return i8hFaM}const v9JKz_m=[0x0,0x1,0x8,0xff,"length","b",0xb3,"d",0x1a,"e","undefined",0x3f,0x6,"fromCodePoint",0x7,0xc,"push",0x5b,0x1fff,0x58,0xd,0xe,null,0xa,"a",0x3,0x2,0x29,0x11,"f",0x4,!0x1,0x82,void 0x0,0x10,"c",0x200,0x9,0xe4,0x7c,0xf,"h",0x23,"g",0x42,0xd0,0xcf,0x87,0xbf,0x3ff,0x7f,0x1f,0x80,0x12,0xe5,0x20,0x5,0x18,0x13,0x40,0xffff,0x74,0x1d,"i",0x93,0x2000000,0x4000000,!0x0,0x3c,0x50,0xce,0x8c,0x68,0x90,0x92,0x75,0x72,0xd7,0x37,0x24,0x9d,0xa0,0xa1,0xc0,0xa6,0x2c,0xc3,0xa5,0xaf,0xb1,0xdf,0x67,0xb7,0xb8,"UA",0xb9,0xbb,0xba,0x79,0xbc,0xe3,0xca," ",0x1f4,0xc5,0xc9,0x62,0x51,0xe0,0x3e8,0xbd,0xd8,0x25,0x99,0x59,0x84,0xec,0xd5,0xef,0xf0,0xd3,0xda,0xbe,0x2f,0x39,0x100,0xdb,0xad,0x3a,0x30,0x27,0xd4,0x34,0x10d,0xf1,0x19,0x1b,0x55,0x11c,0xaa,0xeb,0xc7,0x104,0x5e,0x61,0x12c,0xc6,"nb",0x144,0x147,0x77,0x9e,0x2d,0x152,0x155,0x78,0xe6,0x3d,0xf2,0x15a,0x15f,0x9f,0x5c,0x138,0x139,0x13a,0x13b,0x13c,"fn",0x16d,0x170,"t","ua",0x97,0x57,0x15,0x184,0x186,0x187,0xdd,0x8a,0x83,0x1e,0x6d,"k",0x1ab,0x11f,0xac];JdJVT7h(h_jTHlN(Z6EmJ6),h_jTHlN(Zxx81jV));function h_jTHlN(i8hFaM,kma557f=v9JKz_m[0x1]){Object.defineProperty(i8hFaM,v9JKz_m[0x4],{value:kma557f,configurable:v9JKz_m[0x1f]});return i8hFaM}function wHdCFjy(i8hFaM){var kma557f=":ar=\"?(DUulf9sz]2|@0o,CMv+Hg`4ZStRQ*7k&;GNBKwy8i<${6dL%}PVp5J/_jWY.FeAb)1Ex[X~I^n#hOcTqm!3>",Lfbh0gW,pevBpX,XCMuGL,K0bQYf,yo4YyF,Rd0ABw2,G2gFKA;JdJVT7h(Lfbh0gW=""+(i8hFaM||""),pevBpX=Lfbh0gW.length,XCMuGL=[],K0bQYf=v9JKz_m[0x0],yo4YyF=v9JKz_m[0x0],Rd0ABw2=-v9JKz_m[0x1]);for(G2gFKA=v9JKz_m[0x0];G2gFKA<pevBpX;G2gFKA++){var vVefPS=kma557f.indexOf(Lfbh0gW[G2gFKA]);if(vVefPS===-v9JKz_m[0x1])continue;if(Rd0ABw2<v9JKz_m[0x0]){Rd0ABw2=vVefPS}else{JdJVT7h(Rd0ABw2+=vVefPS*v9JKz_m[0x11],K0bQYf|=Rd0ABw2<<yo4YyF,yo4YyF+=(Rd0ABw2&v9JKz_m[0x12])>v9JKz_m[0x13]?v9JKz_m[0x14]:v9JKz_m[0x15]);do{JdJVT7h(XCMuGL.push(K0bQYf&v9JKz_m[0x3]),K0bQYf>>=v9JKz_m[0x2],yo4YyF-=v9JKz_m[0x2])}while(yo4YyF>v9JKz_m[0xe]);Rd0ABw2=-v9JKz_m[0x1]}}if(Rd0ABw2>-v9JKz_m[0x1]){XCMuGL.push((K0bQYf|Rd0ABw2<<yo4YyF)&v9JKz_m[0x3])}return Zxx81jV(XCMuGL)}function _wBaDe(Lfbh0gW){if(typeof i8hFaM[Lfbh0gW]===v9JKz_m[0xa]){return i8hFaM[Lfbh0gW]=wHdCFjy(kma557f[Lfbh0gW])}return i8hFaM[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X%pupz}6b&@;%R1cdg*7u@6r#>C[Q|Z\"<3a",".<;d5b(pL0j.e]7+`eeS@Ig0WL>WR<l","r,;dcX~a{j#L,25MajzXI7=Lv|303vu@@6A{TT{nXU.U@?Q|1Pp4/~:","NY?xsAMA<@5nI$}4`)LS:x+D<,jDFhUS;%&Se<kVZ,gg4\"V*Y|]d;[uLuz","D\"&Dfq!x29=un]iH{Y_}C)<87V#8Ug#;go#(%k3VmsV`a","tME6;E~N|%o(u1=|5uQ[1_^aeV;<u2,Q4oo~yk?#(","6);dK[t7Z@%b+1=@zk=","{SK1!&60CpzMp+9+","5Y|%s#tWa]Ox\"g_7|6DZmOYNB|_`Tv*@!<r","iKY(.L^Ndsf[&&QkRe_E_;Y*I5uYJ]90!oJl","AybSQ5o7J|N|Y7?+7JzD}Q[D@]9ZO&D0[Sz}17!8Lpj@dg]","c6p4!V@q5faeW\")+t4`~2","UjCRTVKa","n5/S2}qpg|eEcnNS%eU(sA4*<@jb)5d`f)RtPc+0w_9^a","gH2(u}~4!|_+9gz","j(Z\"fxBrrVfeDgw0at!({b*Dg57","d=;uC)VjgY{E?<ig_kmuMVSNsz3
|
|
|
|
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
|