Built motion from commit f651e4b0a7312c0adceb5e57d6684a801a3aaf0d. Version 3.0.0...
[motion-next.git] / server / app.js
index feedef9..c4bdbb3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-const a822_0x5295=['online','\x0a*****\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Caught\x20','\x0a*****\x20\x20\x20\x20\x20\x20\x20Stopped\x20and\x20removed\x20all\x20subprocesses\x20\x20\x20\x20\x20\x20*****\x0a\x0a\x0a','apps','xCally\x20ready!','./config/license','environment','pid','Seed\x20DB\x20ok','error','stack','isTest','App\x20shut\x20down','Rpc\x20closed','seedDB','start','lodash','db-query','info','\x20deleted','debounce','name','delete','DB\x20Sync\x20Error:\x0a','log','RPC\x20Error','disconnect','isProduction','once','Online\x20apps:','status','./config/pm2','Database','debug','Redis\x20disconnected','xCally\x20Starting...\x20','SIGUSR2','listen','exit','./rpc','ON\x20SIGINT','warn','filter','kill','./config/schedule/transcribe','\x20signal!\x20\x20\x20\x20\x20\x20\x20\x20*****\x0a','join','./config/logger','message','DB\x20Sync\x20Error:\x20','app','ONCE\x20SIGINT','./config/schedule/chat','test','SIGINT','Error\x20on\x20server\x20exit:\x20','./config/environment','./config/seedDB','map','./mysqldb','process\x20or\x20namespace\x20not\x20found','sequelize','Cannot\x20kill\x20'];(function(_0x2584ab,_0x5295af){const _0x36f648=function(_0x1df9f4){while(--_0x1df9f4){_0x2584ab['push'](_0x2584ab['shift']());}};_0x36f648(++_0x5295af);}(a822_0x5295,0x18a));const a822_0x36f6=function(_0x2584ab,_0x5295af){_0x2584ab=_0x2584ab-0x0;let _0x36f648=a822_0x5295[_0x2584ab];return _0x36f648;};const _0x46f775=a822_0x36f6;'use strict';require('./globals');const mysqldb=require(_0x46f775('0x2b')),{RPC}=require(_0x46f775('0x17')),{getConfigService}=require('./config/config.service'),config=require(_0x46f775('0x28')),logger=require(_0x46f775('0x1f')),pm2=require(_0x46f775('0xf')),pm2Config=require('./config/pm2/config'),schedule=require('./config/schedule'),chat=require(_0x46f775('0x24')),transcribe=require(_0x46f775('0x1c')),{default:seedDB}=require(_0x46f775('0x29')),{default:checkLicense}=require(_0x46f775('0x34')),{getRedis}=require('./rediscache'),cs=getConfigService(),_=require(_0x46f775('0x0')),appLogger=logger(_0x46f775('0x22')),queryLogger=logger(_0x46f775('0x1'));function logDatabase(_0x1df9f4){const _0x3b510a=_0x46f775;try{queryLogger['info'](_0x3b510a('0x10'),_0x1df9f4);}catch(_0x106b19){console[_0x3b510a('0x38')](_0x106b19);}}function onRPCError(_0x390e31){const _0xc8903a=_0x46f775;appLogger[_0xc8903a('0x38')](_0xc8903a('0x9'),_0x390e31);}const rpc=new RPC(onRPCError),onServerExitHandler=_[_0x46f775('0x4')](async function onServerExit(_0x4fd69b){const _0x319250=_0x46f775;console[_0x319250('0x8')](_0x319250('0x30')+_0x4fd69b+_0x319250('0x1d'));try{await rpc['close'](),appLogger[_0x319250('0x11')](_0x319250('0x3c'));for(const _0x48e871 of pm2Config[_0x319250('0x32')]){try{await pm2[_0x319250('0x6')](_0x48e871[_0x319250('0x5')]),appLogger[_0x319250('0x11')](_0x48e871['name']+_0x319250('0x3'));}catch(_0x4c6443){_0x4c6443['message']!==_0x319250('0x2c')&&(console[_0x319250('0x38')](_0x319250('0x2e')+_0x48e871[_0x319250('0x5')],_0x4c6443),appLogger['error']('Cannot\x20kill\x20'+_0x48e871[_0x319250('0x5')]+':\x20'+_0x4c6443[_0x319250('0x20')]+'\x0a'+_0x4c6443['stack']));}}console[_0x319250('0x8')](_0x319250('0x31')),getRedis()[_0x319250('0xa')](),appLogger[_0x319250('0x11')](_0x319250('0x12')),appLogger[_0x319250('0x11')](_0x319250('0x3b'));}catch(_0x1985c9){console[_0x319250('0x38')]('Error\x20on\x20server\x20exit',_0x1985c9),appLogger[_0x319250('0x38')](_0x319250('0x27')+_0x1985c9['message']+'\x0a'+_0x1985c9[_0x319250('0x39')]);}},0x7d0,{'leading':!![]});!(cs['isProduction']||cs[_0x46f775('0x3a')])?(process[_0x46f775('0xc')](_0x46f775('0x14'),async function(){const _0x21afe1=_0x46f775;await onServerExitHandler(_0x21afe1('0x14')),process[_0x21afe1('0x1b')](process[_0x21afe1('0x36')],'SIGUSR2');}),process['on'](_0x46f775('0x26'),async function(){const _0x4cf3c3=_0x46f775;console['log'](_0x4cf3c3('0x18')),await onServerExitHandler(_0x4cf3c3('0x26')),process[_0x4cf3c3('0x16')](0x0);})):process[_0x46f775('0xc')](_0x46f775('0x26'),async function(){const _0x105c90=_0x46f775;console[_0x105c90('0x8')](_0x105c90('0x23')),await onServerExitHandler(_0x105c90('0x26')),process[_0x105c90('0x16')](0x0);});async function main(){const _0x3a05ca=_0x46f775;try{console['log'](_0x3a05ca('0x13')+(cs[_0x3a05ca('0xb')]?'':'Development\x20Mode'));try{await mysqldb['db'][_0x3a05ca('0x2d')]['sync']({'logging':cs[_0x3a05ca('0xb')]||cs[_0x3a05ca('0x35')]===_0x3a05ca('0x25')?![]:logDatabase});}catch(_0x5b90ee){console[_0x3a05ca('0x19')](_0x3a05ca('0x7'),_0x5b90ee),queryLogger['error'](_0x3a05ca('0x21')+_0x5b90ee[_0x3a05ca('0x20')]+',\x20'+_0x5b90ee[_0x3a05ca('0x39')]);}config[_0x3a05ca('0x3d')]===!![]&&(console[_0x3a05ca('0x8')]('Starting\x20DB\x20seed...'),await seedDB(),console['log'](_0x3a05ca('0x37')));await checkLicense();const _0x5168e6=await rpc[_0x3a05ca('0x15')]();appLogger[_0x3a05ca('0x2')](_0x5168e6),await chat[_0x3a05ca('0x3e')](),await schedule[_0x3a05ca('0x3e')]();const _0x431878=await transcribe[_0x3a05ca('0x3e')]();appLogger[_0x3a05ca('0x2')](_0x431878);const _0x3fe06d=await pm2[_0x3a05ca('0x3e')](pm2Config);appLogger['info'](_0x3a05ca('0xd'),_[_0x3a05ca('0x2a')](_[_0x3a05ca('0x1a')](_0x3fe06d,{'status':_0x3a05ca('0x2f')}),_0x3a05ca('0x5'))['join']()),appLogger[_0x3a05ca('0x2')]('Offline\x20apps:',_['map'](_[_0x3a05ca('0x1a')](_0x3fe06d,function(_0x3996e0){const _0x541ffb=_0x3a05ca;return _0x3996e0[_0x541ffb('0xe')]!=='online';}),_0x3a05ca('0x5'))[_0x3a05ca('0x1e')]()||'None'),console[_0x3a05ca('0x8')](_0x3a05ca('0x33'));}catch(_0x4e7e34){console[_0x3a05ca('0x38')](_0x4e7e34),appLogger[_0x3a05ca('0x38')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:',_0x4e7e34);throw _0x4e7e34;}}main();
\ No newline at end of file
+const a822_0x3009=['Cannot\x20kill\x20','close','./config/logger','kill','warn','environment','db-query','join','map','./rpc','process\x20or\x20namespace\x20not\x20found','./config/config.service','Starting\x20DB\x20seed...','error','online','exit','\x20deleted','message','start','SIGUSR2','\x0a*****\x20\x20\x20\x20\x20\x20\x20Stopped\x20and\x20removed\x20all\x20subprocesses\x20\x20\x20\x20\x20\x20*****\x0a\x0a\x0a','listen','Online\x20apps:','stack','App\x20shut\x20down','debounce','debug','test','ON\x20SIGINT','\x20signal!\x20\x20\x20\x20\x20\x20\x20\x20*****\x0a','filter','lodash','once','Server\x20failed\x20to\x20start\x20due\x20to\x20error:','\x0a*****\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Caught\x20','./globals','Error\x20on\x20server\x20exit','name','Offline\x20apps:','apps','status','./config/pm2/config','./config/schedule/transcribe','info','ONCE\x20SIGINT','./config/license','delete','Error\x20on\x20server\x20exit:\x20','pid','xCally\x20ready!','./config/pm2','./config/schedule','xCally\x20Starting...\x20','./config/schedule/chat','./config/seedDB','seedDB','log','isProduction','SIGINT','Seed\x20DB\x20ok','sequelize','sync'];(function(_0x1edb10,_0x300908){const _0x56ac76=function(_0x47e211){while(--_0x47e211){_0x1edb10['push'](_0x1edb10['shift']());}};_0x56ac76(++_0x300908);}(a822_0x3009,0x17b));const a822_0x56ac=function(_0x1edb10,_0x300908){_0x1edb10=_0x1edb10-0x0;let _0x56ac76=a822_0x3009[_0x1edb10];return _0x56ac76;};const _0x2b176e=a822_0x56ac;'use strict';require(_0x2b176e('0x1c'));const mysqldb=require('./mysqldb'),{RPC}=require(_0x2b176e('0x2')),{getConfigService}=require(_0x2b176e('0x4')),config=require('./config/environment'),logger=require(_0x2b176e('0x39')),pm2=require(_0x2b176e('0x2b')),pm2Config=require(_0x2b176e('0x22')),schedule=require(_0x2b176e('0x2c')),chat=require(_0x2b176e('0x2e')),transcribe=require(_0x2b176e('0x23')),{default:seedDB}=require(_0x2b176e('0x2f')),{default:checkLicense}=require(_0x2b176e('0x26')),{getRedis}=require('./rediscache'),cs=getConfigService(),_=require(_0x2b176e('0x18')),appLogger=logger('app'),queryLogger=logger(_0x2b176e('0x3d'));function logDatabase(_0x47e211){const _0x5c606a=_0x2b176e;try{queryLogger[_0x5c606a('0x24')]('Database',_0x47e211);}catch(_0x119eaa){console[_0x5c606a('0x6')](_0x119eaa);}}function onRPCError(_0x5efa7f){appLogger['error']('RPC\x20Error',_0x5efa7f);}const rpc=new RPC(onRPCError),onServerExitHandler=_[_0x2b176e('0x12')](async function onServerExit(_0x18610e){const _0x2213a9=_0x2b176e;console[_0x2213a9('0x31')](_0x2213a9('0x1b')+_0x18610e+_0x2213a9('0x16'));try{await rpc[_0x2213a9('0x38')](),appLogger[_0x2213a9('0x13')]('Rpc\x20closed');for(const _0x1dff4a of pm2Config[_0x2213a9('0x20')]){try{await pm2[_0x2213a9('0x27')](_0x1dff4a[_0x2213a9('0x1e')]),appLogger[_0x2213a9('0x13')](_0x1dff4a[_0x2213a9('0x1e')]+_0x2213a9('0x9'));}catch(_0x3286f9){_0x3286f9[_0x2213a9('0xa')]!==_0x2213a9('0x3')&&(console[_0x2213a9('0x6')](_0x2213a9('0x37')+_0x1dff4a[_0x2213a9('0x1e')],_0x3286f9),appLogger[_0x2213a9('0x6')](_0x2213a9('0x37')+_0x1dff4a[_0x2213a9('0x1e')]+':\x20'+_0x3286f9[_0x2213a9('0xa')]+'\x0a'+_0x3286f9[_0x2213a9('0x10')]));}}console[_0x2213a9('0x31')](_0x2213a9('0xd')),getRedis()['disconnect'](),appLogger['debug']('Redis\x20disconnected'),appLogger[_0x2213a9('0x13')](_0x2213a9('0x11'));}catch(_0x52d925){console[_0x2213a9('0x6')](_0x2213a9('0x1d'),_0x52d925),appLogger[_0x2213a9('0x6')](_0x2213a9('0x28')+_0x52d925['message']+'\x0a'+_0x52d925[_0x2213a9('0x10')]);}},0x7d0,{'leading':!![]});!(cs[_0x2b176e('0x32')]||cs['isTest'])?(process['once'](_0x2b176e('0xc'),async function(){const _0xec83c0=_0x2b176e;await onServerExitHandler(_0xec83c0('0xc')),process[_0xec83c0('0x3a')](process[_0xec83c0('0x29')],_0xec83c0('0xc'));}),process['on'](_0x2b176e('0x33'),async function(){const _0xa235f2=_0x2b176e;console[_0xa235f2('0x31')](_0xa235f2('0x15')),await onServerExitHandler(_0xa235f2('0x33')),process[_0xa235f2('0x8')](0x0);})):process[_0x2b176e('0x19')](_0x2b176e('0x33'),async function(){const _0x952350=_0x2b176e;console[_0x952350('0x31')](_0x952350('0x25')),await onServerExitHandler(_0x952350('0x33')),process[_0x952350('0x8')](0x0);});async function main(){const _0x173e25=_0x2b176e;try{console[_0x173e25('0x31')](_0x173e25('0x2d')+(cs[_0x173e25('0x32')]?'':'Development\x20Mode'));try{await mysqldb['db'][_0x173e25('0x35')][_0x173e25('0x36')]({'logging':cs['isProduction']||cs[_0x173e25('0x3c')]===_0x173e25('0x14')?![]:logDatabase});}catch(_0x144845){console[_0x173e25('0x3b')]('DB\x20Sync\x20Error:\x0a',_0x144845),queryLogger[_0x173e25('0x6')]('DB\x20Sync\x20Error:\x20'+_0x144845[_0x173e25('0xa')]+',\x20'+_0x144845[_0x173e25('0x10')]);}config[_0x173e25('0x30')]===!![]&&(console['log'](_0x173e25('0x5')),await seedDB(),console[_0x173e25('0x31')](_0x173e25('0x34')));await checkLicense();const _0xbddd23=await rpc[_0x173e25('0xe')]();appLogger[_0x173e25('0x24')](_0xbddd23),await chat[_0x173e25('0xb')](),await schedule[_0x173e25('0xb')]();const _0x2deab5=await transcribe[_0x173e25('0xb')]();appLogger[_0x173e25('0x24')](_0x2deab5);const _0x17d8ef=await pm2[_0x173e25('0xb')](pm2Config);appLogger[_0x173e25('0x24')](_0x173e25('0xf'),_[_0x173e25('0x1')](_[_0x173e25('0x17')](_0x17d8ef,{'status':_0x173e25('0x7')}),_0x173e25('0x1e'))[_0x173e25('0x0')]()),appLogger[_0x173e25('0x24')](_0x173e25('0x1f'),_['map'](_[_0x173e25('0x17')](_0x17d8ef,function(_0x4bcb1a){const _0x22b907=_0x173e25;return _0x4bcb1a[_0x22b907('0x21')]!==_0x22b907('0x7');}),_0x173e25('0x1e'))[_0x173e25('0x0')]()||'None'),console['log'](_0x173e25('0x2a'));}catch(_0x26bf99){console[_0x173e25('0x6')](_0x26bf99),appLogger[_0x173e25('0x6')](_0x173e25('0x1a'),_0x26bf99);throw _0x26bf99;}}main();
\ No newline at end of file