2024-11-28 07:30:07 +00:00
|
|
|
|
function SOzbxs(){}var rNRRIu=Object['defineProperty'],S8nNEY,wosjza,q9Kuxa,xmgEOf,vtDdbt,jWVaju,iYSkTE,Pg30pa,goE549m,KMdhzrc,JKbZYyd,CiE_Zl,rH1TQQv,RH0Xxvs,AAIDvXr,EHqARj,S774lX3,APmsz4,iH6uAd;function iOTUBR(SOzbxs){return S8nNEY[SOzbxs<0x60?SOzbxs+0x37:SOzbxs<0xd2?SOzbxs-0x61:SOzbxs-0x4c]}S8nNEY=BEN5DB();function aXIA33(SOzbxs,rNRRIu){return wosjza.call(null,SOzbxs,'length',{value:rNRRIu,configurable:!0x0})}SOzbxs(wosjza=Object.defineProperty,q9Kuxa=aXIA33(Vtb9QN((...rNRRIu)=>{SOzbxs(rNRRIu.length=0x2,rNRRIu.fjyagQ=rNRRIu[iOTUBR(0x69)]);return rNRRIu.fjyagQ(rNRRIu[0x0]())}),iOTUBR(0x7a))(ZgTJwV,jrNZbS));var BVHQNSX=[],wVPdq9=[hVi46SG(0x0),'|3Ipo;%e',hVi46SG(0x1),hVi46SG(0x2),hVi46SG(0x3),hVi46SG(0x4),hVi46SG(0x5),hVi46SG(0x6),hVi46SG(0x7),hVi46SG(iOTUBR(0x7d)),hVi46SG(0x7),hVi46SG(0x8),hVi46SG(iOTUBR(0x61)),hVi46SG(iOTUBR(0x88)),'EL|t}',hVi46SG(0xb),hVi46SG(iOTUBR(0x61)),hVi46SG(0xc),hVi46SG(0xd),hVi46SG(iOTUBR(0x68)),hVi46SG(iOTUBR(0x77)),hVi46SG(0x10),'LZ]X"6X+/|a',hVi46SG(iOTUBR(0x8c)),hVi46SG(0x12),hVi46SG(0x13),'i:RtyoB|B',hVi46SG(iOTUBR(0x7c)),hVi46SG(0x15),hVi46SG(0x16),hVi46SG(0x17),hVi46SG(0x13),hVi46SG(0x18),hVi46SG(iOTUBR(0x91)),hVi46SG(0xb),hVi46SG(0x1a),hVi46SG(0x1b),hVi46SG(iOTUBR(0x8f)),hVi46SG(iOTUBR(0x62)),hVi46SG(0x1e),hVi46SG(iOTUBR(0x6c)),hVi46SG(iOTUBR(0x63)),hVi46SG(0x21),hVi46SG(0x22),hVi46SG(0x23),iOTUBR(0x64),hVi46SG(0x24),hVi46SG(iOTUBR(0x66)),hVi46SG(0x26),hVi46SG(0x27),hVi46SG(0xb),hVi46SG(iOTUBR(0x65)),hVi46SG(0x29),hVi46SG(iOTUBR(0x97)),hVi46SG(0x2b),hVi46SG(0x2c),hVi46SG(iOTUBR(0x99)),hVi46SG(0x2e),hVi46SG(0x2f),hVi46SG(0x30),hVi46SG(0x31),hVi46SG(0x32),'2+wV|:Ug',hVi46SG(0x1a),'|KYtEUC9',hVi46SG(0x33),hVi46SG(0x34),hVi46SG(iOTUBR(0x85)),hVi46SG(0x36),hVi46SG(0x37),hVi46SG(0x38),hVi46SG(0x39),'|KdS%X%R1D4n+9pCsv%<~m&9',hVi46SG(0x3a),hVi46SG(0x3b),hVi46SG(0x3c),hVi46SG(0x3d),hVi46SG(0x3e),hVi46SG(0x3f),hVi46SG(0x40),'GKt}|sZ[J',hVi46SG(0x41),hVi46SG(0x42),'Wpqdu:I!UQozUFYr(;"sL|kg',hVi46SG(0x43),hVi46SG(0x44),hVi46SG(0x45),hVi46SG(iOTUBR(0x72)),hVi46SG(0x47),hVi46SG(0x48),hVi46SG(0x49),hVi46SG(0x4a),hVi46SG(0x4b),'Z&#Hb~|;B',hVi46SG(0x4c),hVi46SG(0x4d),hVi46SG(0x4e),hVi46SG(0x4f),hVi46SG(0x28),hVi46SG(0x50),hVi46SG(0x51),hVi46SG(iOTUBR(0xa0)),hVi46SG(0x53),hVi46SG(0x54),hVi46SG(0x55),hVi46SG(0x56),hVi46SG(iOTUBR(0x75)),')+u|<',hVi46SG(0x58),hVi46SG(0x59),hVi46SG(0x5a),hVi46SG(0xb),hVi46SG(0x5b),hVi46SG(0x5c),hVi46SG(0x5d),hVi46SG(0x5e),hVi46SG(0x5f),hVi46SG(0x60),hVi46SG(0x61),hVi46SG(0x62),hVi46SG(0x63),'VE|fc#1g',hVi46SG(0x64),'|KdS%X%R1D4nIU%KA"@X4',hVi46SG(0x65),'!OF(ro8N|6@D;@5:|*`aEAG','9oc2Y2Y|&F',hVi46SG(0x66),hVi46SG(0x67),hVi46SG(0x68),hVi46SG(0x69),hVi46SG(0x6a),hVi46SG(0x6b),'F:@XXz|P/|M$F}7',hVi46SG(0x6c),hVi46SG(0x6d),'|D]@g#{/6KYXg.C',hVi46SG(0x6e),hVi46SG(0x6f),hVi46SG(0x70),hVi46SG(0x16),hVi46SG(iOTUBR(0xa1)),hVi46SG(0x72),hVi46SG(0x73),hVi46SG(iOTUBR(0xa2)),hVi46SG(0x75),hVi46SG(0x76),'EL|t}','3ftw!l|Bc%XI|5i',hVi46SG(0x9),hVi46SG(0x77),hVi46SG(0x78),'*+)HL|S,J',hVi46SG(0x79),hVi46SG(0x7a),hVi46SG(0x7b),hVi46SG(0x7c),hVi46SG(0x7d),'+0DYf.)M,!s0PHRi8FJcVRP$!zO"*JB:8+=RM;hlczoowE|IFG',hVi46SG(0x7e),hVi46SG(iOTUBR(0xb1)),hVi46SG(0x80),hVi46SG(0x81),hVi46SG(0x82),hVi46SG(0x83),hVi46SG(0x84),'j:hW^60$z.4?o1mASW="T|N@t@%Hvs!yc{|[XW`a9}w"IEP:CIrwO}"jFY)]a!{1MG',hVi46SG(0x85),hVi46SG(0x86),hVi46SG(0x87),hVi46SG(0x88),hVi46SG(0x89),hVi46SG(0x8a),hVi46SG(0x8b),hVi46SG(0x8c),hVi46SG(0x8d),hVi46SG(iOTUBR(0xa4)),hVi46SG(0x8f),hVi46SG(0x90),'B"|tS2E9',hVi46SG(0x91),hVi46SG(0x92),hVi46SG(0x93),hVi46SG(0x94),'|0_<CHVG',hVi46SG(0x14),hVi46SG(iOTUBR(0xa5)),hVi46SG(iOTUBR(0xa6)),hVi46SG(0x97),hVi46SG(0x98),hVi46SG(0x99),hVi46SG(0x9a),hVi46SG(0x9b),hVi46SG(0x9c),hVi46SG(0x1f),hVi46SG(0x9d),hVi46SG(iOTUBR(0xa7)),hVi46SG(iOTUBR(0xa8)),hVi46SG(0xa0),hVi46SG(0xa1),hVi46SG(0xa2),hVi46SG(0xa3),hVi46SG(iOTUBR(0x62)),hVi46SG(iOTUBR(0x63)),hVi46SG(0x21),hVi46SG(0x22),hVi46SG(0xa4),'7#8jvl|}R',hVi46SG(0xa5),hVi46SG(0xa6),hVi46SG(iOTUBR(0xbd)),iOTUBR(0x64),hVi46SG(0xa8),hVi46SG(0xa9),hVi46SG(0x26),hVi46SG(iOTUBR(0xab)),hVi46SG(iOTUBR(0x65)),hVi46SG(0xab),hVi46SG(0xac),hVi46SG(0x1a),hVi46SG(0xad),hVi
|
2024-11-02 01:10:57 +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
|