mirror of
https://github.com/shufflewzc/faker3.git
synced 2024-11-10 09:39:18 +08:00
16 lines
22 KiB
JavaScript
16 lines
22 KiB
JavaScript
/*
|
||
活动名称:权益红包(个别号有)
|
||
环境变量:
|
||
jd_qyhb_interval // 自定义运行间隔时长(整数,单位毫秒),默认2000
|
||
jd_qyhb_notify // 是否推送通知(true/false),默认不推送
|
||
jd_qyhb_pinFilter // 账号pin过滤,多个用@进行分割
|
||
|
||
cron:28 12 * * *
|
||
|
||
*/
|
||
|
||
const $ = new Env('权益红包')
|
||
const _0x3cf9f8=_0x2a8e;(function(_0x4d3205,_0x540790){const _0x38a5df=_0x2a8e,_0x2a51a9=_0x4d3205();while(!![]){try{const _0x15198d=parseInt(_0x38a5df(0xb3,'rEz6'))/0x1*(parseInt(_0x38a5df(0x9f,'rEz6'))/0x2)+parseInt(_0x38a5df(0x98,'L](g'))/0x3*(parseInt(_0x38a5df(0x85,']0UV'))/0x4)+parseInt(_0x38a5df(0x9e,'a3jb'))/0x5*(-parseInt(_0x38a5df(0xb7,'&N%)'))/0x6)+-parseInt(_0x38a5df(0x10a,'L](g'))/0x7*(-parseInt(_0x38a5df(0xa5,'cnyf'))/0x8)+parseInt(_0x38a5df(0xf4,'xHEv'))/0x9*(parseInt(_0x38a5df(0x89,'v7$c'))/0xa)+parseInt(_0x38a5df(0x88,'MxXB'))/0xb*(-parseInt(_0x38a5df(0xc0,'AQQq'))/0xc)+parseInt(_0x38a5df(0xc6,'B8th'))/0xd;if(_0x15198d===_0x540790)break;else _0x2a51a9['push'](_0x2a51a9['shift']());}catch(_0x3538c8){_0x2a51a9['push'](_0x2a51a9['shift']());}}}(_0x166f,0x37929));const jdCookie=require('./jdCookie'),notify=require(_0x3cf9f8(0xa2,'vYvx')),common=require(_0x3cf9f8(0x10b,'Jw1s'));function _0x2a8e(_0x119f8f,_0x2cfb43){const _0x166fe5=_0x166f();return _0x2a8e=function(_0x2a8edf,_0x223262){_0x2a8edf=_0x2a8edf-0x7f;let _0x3edd3c=_0x166fe5[_0x2a8edf];if(_0x2a8e['TmOpGu']===undefined){var _0x3380c6=function(_0x548c98){const _0x542bb7='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x2d555f='',_0x359ec2='';for(let _0x3c1bae=0x0,_0x263e74,_0x59ae8a,_0x5dbdaf=0x0;_0x59ae8a=_0x548c98['charAt'](_0x5dbdaf++);~_0x59ae8a&&(_0x263e74=_0x3c1bae%0x4?_0x263e74*0x40+_0x59ae8a:_0x59ae8a,_0x3c1bae++%0x4)?_0x2d555f+=String['fromCharCode'](0xff&_0x263e74>>(-0x2*_0x3c1bae&0x6)):0x0){_0x59ae8a=_0x542bb7['indexOf'](_0x59ae8a);}for(let _0x35ebca=0x0,_0x3e2121=_0x2d555f['length'];_0x35ebca<_0x3e2121;_0x35ebca++){_0x359ec2+='%'+('00'+_0x2d555f['charCodeAt'](_0x35ebca)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x359ec2);};const _0x4553a9=function(_0x2c3d53,_0x1ae6e1){let _0x415866=[],_0xaf218f=0x0,_0x36dd4a,_0x5cff0b='';_0x2c3d53=_0x3380c6(_0x2c3d53);let _0x56935c;for(_0x56935c=0x0;_0x56935c<0x100;_0x56935c++){_0x415866[_0x56935c]=_0x56935c;}for(_0x56935c=0x0;_0x56935c<0x100;_0x56935c++){_0xaf218f=(_0xaf218f+_0x415866[_0x56935c]+_0x1ae6e1['charCodeAt'](_0x56935c%_0x1ae6e1['length']))%0x100,_0x36dd4a=_0x415866[_0x56935c],_0x415866[_0x56935c]=_0x415866[_0xaf218f],_0x415866[_0xaf218f]=_0x36dd4a;}_0x56935c=0x0,_0xaf218f=0x0;for(let _0x5e54b4=0x0;_0x5e54b4<_0x2c3d53['length'];_0x5e54b4++){_0x56935c=(_0x56935c+0x1)%0x100,_0xaf218f=(_0xaf218f+_0x415866[_0x56935c])%0x100,_0x36dd4a=_0x415866[_0x56935c],_0x415866[_0x56935c]=_0x415866[_0xaf218f],_0x415866[_0xaf218f]=_0x36dd4a,_0x5cff0b+=String['fromCharCode'](_0x2c3d53['charCodeAt'](_0x5e54b4)^_0x415866[(_0x415866[_0x56935c]+_0x415866[_0xaf218f])%0x100]);}return _0x5cff0b;};_0x2a8e['cTAuoW']=_0x4553a9,_0x119f8f=arguments,_0x2a8e['TmOpGu']=!![];}const _0x4546dd=_0x166fe5[0x0],_0x58b418=_0x2a8edf+_0x4546dd,_0x23e254=_0x119f8f[_0x58b418];return!_0x23e254?(_0x2a8e['VyPDvD']===undefined&&(_0x2a8e['VyPDvD']=!![]),_0x3edd3c=_0x2a8e['cTAuoW'](_0x3edd3c,_0x223262),_0x119f8f[_0x58b418]=_0x3edd3c):_0x3edd3c=_0x23e254,_0x3edd3c;},_0x2a8e(_0x119f8f,_0x2cfb43);}let taskThreads=process[_0x3cf9f8(0xf5,'kcax')][_0x3cf9f8(0x97,'v7$c')]||'1';const runInterval=process[_0x3cf9f8(0x102,'dxR^')]['jd_qyhb_interval']||_0x3cf9f8(0xf6,'bCoZ'),isNotify=(process[_0x3cf9f8(0xc5,'cnyf')][_0x3cf9f8(0xf9,'x(TX')]||process[_0x3cf9f8(0xc4,'68Z#')][_0x3cf9f8(0xaf,'dxR^')])==='true',pinFilter=(process[_0x3cf9f8(0x80,'C)oW')][_0x3cf9f8(0xcb,'c2Ol')]||'')[_0x3cf9f8(0xd4,'xm*G')]('@'),maxThreads=0x1;let cookiesArr=Object[_0x3cf9f8(0x86,'x(TX')](jdCookie)[_0x3cf9f8(0x114,'dxR^')](_0x4553a9=>jdCookie[_0x4553a9])['filter'](_0x548c98=>_0x548c98);function _0x166f(){const _0x379961=['WRjgbW','WPfiWRC','eokESry','56EgWQ7OVzROOiNPL4hPMzBMLyVPLju','s0fjW43cLbqFWQi','BsVdMq','AG3dMWqmy37cN1a','WQ5wWO3cVa','jaVcLCoXWRtcVcFdMConDIVcLa','u8opqmkH','WOjRzG','sYpdNt4yW4DUWO0','W5pcRmkUWRyEWR4','W6NdRgC','soE4GUwoKLa','WQjwWQddVe7dOq','WRRcMZO','4PMiW4lOH4pLRyFKUjFOVOJOO4BPLkpPMOBMLOlPLPNORAZNVjBPLlVORQu','nmk0iSkI','kWOGWQxcV8oLsvFdMCkdW57cRCoPyuhdM2vkoabq','WQJcIg/cGmkTcHmc','W5pcPSkNWPqyWQq','W57cLHddH1PMleq','bbJcJq','W6JdQ8kxaSoHWOK','W5VcJsOufslcRCofWOFdPSoqWOBdTCofW6XM','r3edWRnnCq','FmoSWRRdICoAWOu','o8k0iq','W4ZcMJWRbG','WRdcPCkrkSkPW5lcPSkuWQ/dSCkW','W4ZcHJG','W48xW6bN','fqPc','WQDoWPRcQq','W6NcJupdGCoki2xdQCo9rYyjFcW','v0HcWRrHW5TJWPHDW4e3W4BcICoD','WPK+f8kLW7BcGvldLSkqgHZcHmkr','w0vuW7xcRXOBWQLMiMddSSkZWQ4','W5NcGGRdMW','8lwjNfK','m3KOideC','6zwE6zMB5Pw96zshWOJcPSoA','WRhdKs7dMmo5lM7dG8o4','WRvnWRG','r0XFWPa','6Acf5yY/5AsT6lAvW6G','E8kytG','W5VcJt8XetlcSG','WQPCWP3cLuuXWR55uCkBFSoDW4RdQce9W7xdTGa','WOKvW6G6','BshdKmoPWQFcGW','W6xdIMpdVCkWisFdUa9F','DrpcMGm/we/dPNlcS8obW4b4BGbTW5vbW4ZcGaFcG8kl','aSk9FSomeNhcHKVcK3bfn8k0oCkxeK5sW75amG','W4WEW6LLpcRcGe8yWQe','EmoxWR9fqqO','pSk1jCkRW4b3W7FdSG','WP5iWR4XgJG','8yglI8k7','WQu8tXtcUxNdNq','W6/cHNS','WR1cWR4','ACkYWPqNsCki','W7tcIhxdHmoNiMRdKW','WPbTjq','ySoSWQFdM8ocWPK','44oJ5OYQ56Am44gu6k2j5yEF6iYP5y2tWQZdOu88W4hcSa','c8k9B8oTmMBcHfBcQgzH','WOBcH0ZcUqW9W6FcUgqrWQxcVrDji2xcMuBdOv8F','WRxcVSokv8kTWOtdQ8ofD8odW7O','W6JcJgxdGW','DcnzlCoYeW','yxGVn3eDf3uRcSoyh8kW','W64QWRPvWOqrW5K3WO0','gVc9GlFcJUI9VUIIOEE5UEACLSoN','tIldMq','6AkK5y6B5AAp6lw3nG','jmk3l8kKW5a','WQnwWQ3dMKxdTL8','WRHxWRRdIvpcVWpdQ2n8W5v4CaTWxt5ZnG','4P2FkEIgUUAEQoI+J+IJK+MbPEwlOUs5SUMxL+IUImop','W43cVmkUWPqeWRi','WPNdNmo1','y8ksW6mXyCkRW5ap','D2JdLmoL','W6FdPSkyc8o7WOtdJG','zCkGWP8','WRn+W5v0WOK3W7G9WOfDbSkRggNcICot','W6xdIMBcOSkJnqtdGca','WO/cH0FcIb8','44cY6lwR5y2j','6lw05y645PE25Pwg','W53cMdxdNg1UlurJqNxcUWhcNG','WRVcLZRcRCkDoa','iSkqEmo3i8kGFa','iCk4W6ddNCo0WRRdQmoCWP0','pEIUUUAXQowLUEI2PuFINRBcJUAwTowsJUw7QEAuUUAnPa','wmowrmkW','W5VcNmoNamojuJlcLbxcTcNcGSkCWRNcMdtcRhZcK38yWOZdR8k7WRhcTre','D8ksW74Mxq','wSkjWOxcU8oIWPVdKCkRWO4+rCkYWODeW7TFWONdGCkraCkBWQNcG0tcVrG','iJdcMCk2emoQsSkaWPxcMW','WPHIwKpdHCo0da','6AoD5y+QWRq','4PYKv+AFGoECM+ISOoAXJSk9','5y6/6yAR5B+75zkQ54MN5OotBSojWQqYzSomr07cObu','W6f5hcFcQetdRutcTW','WR/cIe3cJmkAcGWmcSkXcSoJxmkb','WPJdLSoHb8obwsq','WO7cI1e','fXhcImoT','WRPhWPhdIfNdRu7cM0uMWO98obG','W57cUCkWWR0dWRuVWOjEcSkGqColAmkVW6TzWRJdVfZdKMdcM1yGECo5BmoHW68pWRCN','r+IUK+AYUEwrIow5HCoY','xd3dNmkVWPf1W4CqE8kacmkJW6zBBCkZrHLysCk8hwRcTCoGW6xdGmo8','jCk7W6FcN8ogWR3dJ8obWP8L','W7BcKxRcP3CRWQORW6pcKa','F2BdHW','W5xOR7tMSjhLPi/OT7JcS+kFQt8','jSofWRX9aCoXWOKysNXUjCoX','hSk9AmoDlga','W7FdOSkqbSoW','zmotWQfv','nv3cGHi','WOFdLSoIeCobsG','bHlcJ8kAWOvPW7ajomkelCkvWRbyCSk/FtXYvSoW','nhBcJCk/WRVcU2ldGGHV','WRNcGNhcJ8kycau','wuxcN8kjWP91W4ud','4P65WPpMNRJOGONMR4pNOzdLPyxNKR1N','DhSkgdeIra','6yoN55+c5O246ygwsx/cSW','W45MvW','DMFdLG','jmksWQ9aWRNdJMi0EmoyWO02CG','dHGxWO7cMqW4WOPXhq','Fa4Zda','nI5IBW','w8kzWOxcMSozWOW','ymowWPnbvbzobrfEu8kzjmoAW6iBWQS','W4hcKHJdL2T9mG','W7GrA8kzx8kzW64Zc8owCuBcUSk5W6tdMmkNWOVcTCk5W7xdVmkJvgn9','WP3cN8otiCoSW7ldS8oQWPNdQ2m4W4FcVSk8seJcTSkqWOz6','WPhdKSoMfq','6lAL5yYE5PE85PE4','CCo5WR3cGmodW4pdGmoUW4mmoqC','WRdcLYdcICkgpWBdNc5csgZdT8k2','wLNdHSk4W6ZdR27dICkKmG','q11AWO1N','xSknWOlcQW'];_0x166f=function(){return _0x379961;};return _0x166f();}!cookiesArr[0x0]&&($['msg']($[_0x3cf9f8(0xbb,'Jw1s')],_0x3cf9f8(0x82,'!luZ')),process[_0x3cf9f8(0xdf,'1iE0')](0x1));!(async()=>{const _0xd19756=_0x3cf9f8;notify[_0xd19756(0x110,'bCoZ')]({'title':$[_0xd19756(0xba,'c2Ol')]}),await Main(),isNotify&¬ify[_0xd19756(0xb4,'C&*L')]()&&await notify[_0xd19756(0xfd,'C8Zy')]();})()[_0x3cf9f8(0xa3,'&N%)')](_0x542bb7=>$[_0x3cf9f8(0xeb,'h)NT')](_0x542bb7))['finally'](()=>$[_0x3cf9f8(0xc8,'AvA6')]());async function Main(){const _0x2742db=_0x3cf9f8;try{try{const _0x359ec2=parseInt(taskThreads);_0x359ec2>0x0&&_0x359ec2!==0x1&&(taskThreads=_0x359ec2);}catch{taskThreads=0x1;}taskThreads=Math[_0x2742db(0xe6,'L](g')](taskThreads,maxThreads),$[_0x2742db(0x7f,'x(TX')]=null;if(runInterval)try{const _0x3c1bae=parseInt(runInterval);_0x3c1bae>=0x0&&($[_0x2742db(0xec,'C8Zy')]=_0x3c1bae);}catch{console[_0x2742db(0xdb,'i8aD')](_0x2742db(0xe7,'&b)$'));}$[_0x2742db(0x10c,'By[P')]=[],console['log']('=========='+$['name']+_0x2742db(0xa9,'*02!')),console[_0x2742db(0x8b,'Ht^o')](_0x2742db(0x100,'(XI3')+$[_0x2742db(0xda,'5N*m')]/0x3e8+_0x2742db(0xd9,'&N%)')),console[_0x2742db(0xf2,'Hbzl')]('代理开关:\x20['+common[_0x2742db(0xfa,'xm*G')]()+']'),console[_0x2742db(0xed,'AQQq')](_0x2742db(0xc3,'bCoZ')+(isNotify?'开启':'关闭')+']'),console[_0x2742db(0x105,'a3jb')]('账号过滤:\x20['+pinFilter['join'](',\x20')+']'),console[_0x2742db(0x113,'x(TX')](_0x2742db(0xd3,'*02!')+$[_0x2742db(0xa1,'1iE0')]+'变量状态结束=========='),console[_0x2742db(0xed,'AQQq')](''),await common[_0x2742db(0xea,'Ocsu')](taskThreads,cookiesArr,taskFnc),$[_0x2742db(0xca,'XT8S')]=![];$['needRemoveCookieIndex'][_0x2742db(0xe2,'h)NT')]>0x0&&(cookiesArr=cookiesArr['filter']((_0x263e74,_0x59ae8a)=>!$[_0x2742db(0xe9,'AbZG')][_0x2742db(0x10f,'Hbzl')](_0x59ae8a+0x1)),$[_0x2742db(0xce,'!luZ')]=[]);const _0x2d555f=notify['getMessage']();_0x2d555f&&console['log'](_0x2742db(0x8a,'rEz6')+_0x2d555f[_0x2742db(0xbf,'Ocsu')](/:/g,_0x2742db(0xd8,'xm*G')));}catch(_0x5dbdaf){console[_0x2742db(0x92,'vYvx')](_0x2742db(0x90,'cnyf')+_0x5dbdaf);}}async function taskFnc(_0x35ebca,_0x3e2121){const _0x4d0c26=_0x3cf9f8;if($['runEnd'])return{'runEnd':!![]};const _0x2c3d53=decodeURIComponent(common[_0x4d0c26(0xd2,'L](g')](_0x35ebca,'pt_pin'));function _0x1ae6e1(_0x5f1a2e,_0x192783){const _0x6d1563=_0x4d0c26;if(_0x5f1a2e[_0x6d1563(0xf1,'rEz6')]<=0x4)return _0x5f1a2e;else{const _0x33a5a4=_0x5f1a2e[_0x6d1563(0xb9,']0UV')](0x0,0x2),_0x476c66=_0x5f1a2e[_0x6d1563(0x8d,'Hbzl')](-0x2),_0xd48215=Math[_0x6d1563(0x96,'$L7o')](_0x192783-_0x33a5a4[_0x6d1563(0x109,'i8aD')]-_0x476c66[_0x6d1563(0x9d,'L](g')],0x0),_0x19e93c='*'[_0x6d1563(0xbc,'vYvx')](_0xd48215);return _0x33a5a4+_0x19e93c+_0x476c66;}}const _0x415866=decodeURIComponent(_0x2c3d53),_0xaf218f=_0x1ae6e1(_0x415866,0x6),_0x36dd4a=_0x4d0c26(0x9a,'Ht^o')+_0x3e2121+'】'+_0xaf218f+':',_0x5cff0b=notify['create'](_0x3e2121,_0x2c3d53);if(pinFilter[_0x4d0c26(0xee,']0UV')]>0x0&&(pinFilter[_0x4d0c26(0xe1,'Ht^o')](_0x2c3d53)||pinFilter['includes'](encodeURIComponent(_0x2c3d53)))){_0x5cff0b[_0x4d0c26(0xad,'&b)$')]('已设置跳过运行当前账号'),console[_0x4d0c26(0xd7,'bCoZ')](_0x5cff0b['getInlineContent']()),$[_0x4d0c26(0xbd,'AQQq')][_0x4d0c26(0x108,'Kd06')](_0x3e2121);return;}const _0x56935c=await common[_0x4d0c26(0xfc,'5N*m')](_0x35ebca);if(!_0x56935c&&typeof _0x56935c===_0x4d0c26(0xa6,'t90#')){console['log'](_0x36dd4a+_0x4d0c26(0xd0,'x(TX')),_0x5cff0b[_0x4d0c26(0xe3,'yv3w')](_0x4d0c26(0x9b,'MxXB')),$[_0x4d0c26(0x84,'&b)$')][_0x4d0c26(0xae,'*02!')](_0x3e2121);return;}const _0x5e54b4=common[_0x4d0c26(0x99,'&b)$')](_0x2c3d53);await _0x57df96(_0x4d0c26(0xa4,'XT8S'));if($[_0x4d0c26(0xe5,'dxR^')])return{'runEnd':!![]};await $[_0x4d0c26(0x103,'xm*G')](parseInt($[_0x4d0c26(0x93,'&N%)')]*0x1+0x1f4,0xa));async function _0x340b68(_0x3bb90c,_0x2410c0){const _0xd39240=_0x4d0c26;try{switch(_0x3bb90c){case'queryPanamaPage':break;case'sendUserIncreaseRedPackage':if(_0x2410c0[_0xd39240(0xdd,'Sbb]')]===0x0){if(_0x2410c0[_0xd39240(0x10e,'c2Ol')]&&_0x2410c0[_0xd39240(0x81,'rEz6')]['redPackageResult']&&_0x2410c0['result'][_0xd39240(0xef,'kcax')][_0xd39240(0x8e,'dxR^')]){const {discount:_0x4e1b45,beginTime:_0x4d275c,endTime:_0x5d50f0}=_0x2410c0[_0xd39240(0x81,'rEz6')]['redPackageResult']['data'],_0x8bd85e=new Date(_0x4d275c),_0x17b73f=new Date(_0x5d50f0);console['log'](_0x36dd4a+_0xd39240(0xa7,'Jw1s')+_0x4e1b45+']红包('+_0x8bd85e[_0xd39240(0xab,'Ocsu')]()+'-'+_0x17b73f['toLocaleString']()+')'),_0x5cff0b[_0xd39240(0x87,'@4Lx')]('['+_0x4e1b45+_0xd39240(0xe4,'B8th')+_0x8bd85e[_0xd39240(0x9c,'C8Zy')]()+'-'+_0x17b73f['toLocaleString']()+')');}else msg=common[_0xd39240(0x83,'By[P')](_0x2410c0[_0xd39240(0xff,'xWUe')]),console['log'](_0x36dd4a+_0xd39240(0x8c,'Ht^o')+_0x2410c0[_0xd39240(0xb8,'By[P')]['ret']+']:'+msg);}else msg=common['getErrorMsg'](_0x2410c0),console['log'](_0x36dd4a+_0xd39240(0x104,'x(TX')+_0x2410c0[_0xd39240(0xe8,'Hbzl')]+']:'+msg);break;}}catch(_0x476a38){console[_0xd39240(0x92,'vYvx')](_0xd39240(0xc1,'vYvx')+_0x3bb90c+_0xd39240(0xb1,'*02!')+(_0x476a38[_0xd39240(0xac,'vYvx')]||_0x476a38));}}async function _0x57df96(_0x2c3b4d){const _0x4df151=_0x4d0c26;if($[_0x4df151(0x91,'h)NT')])return;let _0x42b3dc='',_0x1c3a23=null,_0x2f06a4=null,_0x1ab36b=_0x4df151(0xf7,'MxXB');switch(_0x2c3b4d){case'queryPanamaPage':_0x42b3dc='https://api.m.jd.com/client.action',_0x2f06a4={'functionId':_0x2c3b4d,'body':JSON['stringify']({'activityId':_0x4df151(0xb2,'AQQq'),'dynamicParam':{},'geo':{'lng':'','lat':''}}),'clientVersion':common['getLatestAppVersion'](),'client':_0x4df151(0xe0,'C)oW')};break;case _0x4df151(0xcd,'Z85]'):_0x42b3dc='https://api.m.jd.com/client.action',_0x2f06a4={'functionId':_0x2c3b4d,'appid':_0x4df151(0xf8,'Sbb]'),'body':JSON['stringify']({'source':_0x4df151(0x95,']0UV'),'receiveKey':''}),'clientVersion':common[_0x4df151(0x107,'Sbb]')](),'client':'wh5'};break;default:console['log'](_0x4df151(0xa8,'AQQq')+_0x2c3b4d);return;}const _0x538910={};_0x1c3a23&&Object[_0x4df151(0xf0,'Ru4m')](_0x1c3a23,_0x538910);_0x2f06a4&&Object[_0x4df151(0x115,'$L7o')](_0x2f06a4,_0x538910);const _0x3ffb8b={'url':_0x42b3dc,'method':_0x1ab36b,'headers':{'Host':_0x4df151(0xd1,'rEz6'),'Origin':_0x4df151(0x8f,'dxR^'),'Content-Type':_0x4df151(0xb0,'h)NT'),'Cookie':_0x35ebca,'Referer':'https://h5.m.jd.com/babelDiy/Zeus/4J6QFyZv5afY9hvirKNz4Zg46Wq3/index.html','User-Agent':_0x5e54b4},'params':_0x2f06a4,'data':_0x1c3a23,'timeout':0x7530};_0x1ab36b===_0x4df151(0xd6,'C)oW')&&(delete _0x3ffb8b[_0x4df151(0xc9,'MxXB')],delete _0x3ffb8b[_0x4df151(0xcc,'C8Zy')][_0x4df151(0xde,'*02!')]);const _0x102530=0x1;let _0x21319f=0x0,_0x19bead=null;while(_0x21319f<_0x102530){_0x21319f>0x0&&await $[_0x4df151(0xd5,'XT8S')](0x3e8);const _0x55566e=await common[_0x4df151(0x106,'kcax')](_0x3ffb8b);if(!_0x55566e[_0x4df151(0x112,'gc(a')]){_0x19bead=_0x4df151(0x111,'Kd06')+_0x2c3b4d+_0x4df151(0xb6,'C)oW')+_0x55566e[_0x4df151(0xf3,'kcax')],_0x21319f++;continue;}if(!_0x55566e[_0x4df151(0x94,'cnyf')]){_0x19bead=_0x4df151(0xfe,'C8Zy')+_0x2c3b4d+_0x4df151(0xa0,'@4Lx'),_0x21319f++;continue;}await _0x340b68(_0x2c3b4d,_0x55566e[_0x4df151(0xcf,'vYvx')]);break;}_0x21319f>=_0x102530&&console[_0x4df151(0xb5,'cnyf')](_0x19bead);}}
|
||
// prettier-ignore
|
||
function Env(t,e){"undefined"!=typeof process&&JSON.stringify(process.env).indexOf("GITHUB")>-1&&process.exit(0);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((e,i)=>{s.call(this,t,(t,s,r)=>{t?i(t):e(s)})})}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.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.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`🔔${this.name}, 开始!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient&&"undefined"==typeof $loon}isLoon(){return"undefined"!=typeof $loon}toObj(t,e=null){try{return JSON.parse(t)}catch{return e}}toStr(t,e=null){try{return JSON.stringify(t)}catch{return e}}getjson(t,e){let s=e;const i=this.getdata(t);if(i)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(e=>{this.get({url:t},(t,s,i)=>e(i))})}runScript(t,e){return new Promise(s=>{let i=this.getdata("@chavy_boxjs_userCfgs.httpapi");i=i?i.replace(/\n/g,"").trim():i;let r=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");r=r?1*r:20,r=e&&e.timeout?e.timeout:r;const[o,h]=i.split("@"),n={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(n,(t,e,i)=>s(i))}).catch(t=>this.logErr(t))}loaddata(){if(!this.isNode())return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e);if(!s&&!i)return{};{const i=s?t:e;try{return JSON.parse(this.fs.readFileSync(i))}catch(t){return{}}}}}writedata(){if(this.isNode()){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e),r=JSON.stringify(this.data);s?this.fs.writeFileSync(t,r):i?this.fs.writeFileSync(e,r):this.fs.writeFileSync(t,r)}}lodash_get(t,e,s){const i=e.replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(const t of i)if(r=Object(r)[t],void 0===r)return s;return r}lodash_set(t,e,s){return Object(t)!==t?t:(Array.isArray(e)||(e=e.toString().match(/[^.[\]]+/g)||[]),e.slice(0,-1).reduce((t,s,i)=>Object(t[s])===t[s]?t[s]:t[s]=Math.abs(e[i+1])>>0==+e[i+1]?[]:{},t)[e[e.length-1]]=s,t)}getdata(t){let e=this.getval(t);if(/^@/.test(t)){const[,s,i]=/^@(.*?)\.(.*?)$/.exec(t),r=s?this.getval(s):"";if(r)try{const t=JSON.parse(r);e=t?this.lodash_get(t,i,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,i,r]=/^@(.*?)\.(.*?)$/.exec(e),o=this.getval(i),h=i?"null"===o?null:o||"{}":"{}";try{const e=JSON.parse(h);this.lodash_set(e,r,t),s=this.setval(JSON.stringify(e),i)}catch(e){const o={};this.lodash_set(o,r,t),s=this.setval(JSON.stringify(o),i)}}else s=this.setval(t,e);return s}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,e){return this.isSurge()||this.isLoon()?$persistentStore.write(t,e):this.isQuanX()?$prefs.setValueForKey(t,e):this.isNode()?(this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0):this.data&&this.data[e]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,e=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();s&&this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t,e=null){const s=e?new Date(e):new Date;let i={"M+":s.getMonth()+1,"d+":s.getDate(),"H+":s.getHours(),"m+":s.getMinutes(),"s+":s.getSeconds(),"q+":Math.floor((s.getMonth()+3)/3),S:s.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(s.getFullYear()+"").substr(4-RegExp.$1.length)));for(let e in i)new RegExp("("+e+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?i[e]:("00"+i[e]).substr((""+i[e]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};if(this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r))),!this.isMuteLog){let t=["","==============📣系统通知📣=============="];t.push(e),s&&t.push(s),i&&t.push(i),console.log(t.join("\n")),this.logs=this.logs.concat(t)}}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`❗️${this.name}, 错误!`,t.stack):this.log("",`❗️${this.name}, 错误!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`🔔${this.name}, 结束! 🕛 ${s} 秒`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)}
|