Built motion from commit f738f9592c388b9f9eb3948f400a5c9d717a3561. Version 3.0.0...
[motion-next.git] / server / app.js
index ad59de0..9c69916 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-const a984_0x12b0=['seedDB','disconnect','map','online','Seed\x20DB\x20ok','\x0a*****\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Caught\x20','./config/pm2/config','./rpc','isTest','listen','sequelize','log','\x20deleted','once','pid','SIGUSR2','Rpc\x20closed','process\x20or\x20namespace\x20not\x20found','stack','message','name','close','SIGINT','xCally\x20Starting...\x20','./config/schedule/chat','ON\x20SIGINT','info','sync','./mysqldb','./config/schedule/transcribe','DB\x20Sync\x20Error:\x20','join','Cannot\x20kill\x20','app','App\x20shut\x20down','Redis\x20disconnected','Online\x20apps:','./config/schedule','./config/license','debounce','delete','status','start','./globals','None','Development\x20Mode','environment','exit','filter','ONCE\x20SIGINT','Error\x20on\x20server\x20exit','./config/logger','apps','kill','debug','isProduction','RPC\x20Error','\x20signal!\x20\x20\x20\x20\x20\x20\x20\x20*****\x0a','error','Error\x20on\x20server\x20exit:\x20','lodash','Server\x20failed\x20to\x20start\x20due\x20to\x20error:','xCally\x20ready!','warn'];(function(_0x3d3dae,_0x26bec5){const _0x12b07e=function(_0x100025){while(--_0x100025){_0x3d3dae['push'](_0x3d3dae['shift']());}};_0x12b07e(++_0x26bec5);}(a984_0x12b0,0xb6));const a984_0x1000=function(_0x3d3dae,_0x26bec5){_0x3d3dae=_0x3d3dae-0x1d7;let _0x12b07e=a984_0x12b0[_0x3d3dae];return _0x12b07e;};const a984_0x452de5=a984_0x1000;'use strict';require(a984_0x452de5(0x20c));const mysqldb=require(a984_0x452de5(0x1fd)),{RPC}=require(a984_0x452de5(0x1e8)),{getConfigService}=require('./config/config.service'),config=require('./config/environment'),logger=require(a984_0x452de5(0x214)),pm2=require('./config/pm2'),pm2Config=require(a984_0x452de5(0x1e7)),schedule=require(a984_0x452de5(0x206)),chat=require(a984_0x452de5(0x1f9)),transcribe=require(a984_0x452de5(0x1fe)),{default:seedDB}=require('./config/seedDB'),{default:checkLicense}=require(a984_0x452de5(0x207)),{getRedis}=require('./rediscache'),cs=getConfigService(),_=require(a984_0x452de5(0x1dd)),appLogger=logger(a984_0x452de5(0x202)),queryLogger=logger('db-query');function logDatabase(_0x4597bf){const _0x1e8cfd=a984_0x452de5;try{queryLogger[_0x1e8cfd(0x1fb)]('Database',_0x4597bf);}catch(_0x56986f){console[_0x1e8cfd(0x1db)](_0x56986f);}}function onRPCError(_0x147657){const _0x2bda9a=a984_0x452de5;appLogger[_0x2bda9a(0x1db)](_0x2bda9a(0x1d9),_0x147657);}const rpc=new RPC(onRPCError),onServerExitHandler=_[a984_0x452de5(0x208)](async function onServerExit(_0x90d864){const _0x69841f=a984_0x452de5;console[_0x69841f(0x1ec)](_0x69841f(0x1e6)+_0x90d864+_0x69841f(0x1da));try{await rpc[_0x69841f(0x1f6)](),appLogger[_0x69841f(0x1d7)](_0x69841f(0x1f1));for(const _0x5e22aa of pm2Config[_0x69841f(0x215)]){try{await pm2[_0x69841f(0x209)](_0x5e22aa['name']),appLogger['debug'](_0x5e22aa[_0x69841f(0x1f5)]+_0x69841f(0x1ed));}catch(_0x311cf2){_0x311cf2['message']!==_0x69841f(0x1f2)&&(console[_0x69841f(0x1db)]('Cannot\x20kill\x20'+_0x5e22aa['name'],_0x311cf2),appLogger[_0x69841f(0x1db)](_0x69841f(0x201)+_0x5e22aa[_0x69841f(0x1f5)]+':\x20'+_0x311cf2['message']+'\x0a'+_0x311cf2['stack']));}}console[_0x69841f(0x1ec)]('\x0a*****\x20\x20\x20\x20\x20\x20\x20Stopped\x20and\x20removed\x20all\x20subprocesses\x20\x20\x20\x20\x20\x20*****\x0a\x0a\x0a'),getRedis()[_0x69841f(0x1e2)](),appLogger['debug'](_0x69841f(0x204)),appLogger[_0x69841f(0x1d7)](_0x69841f(0x203));}catch(_0x638964){console['error'](_0x69841f(0x213),_0x638964),appLogger[_0x69841f(0x1db)](_0x69841f(0x1dc)+_0x638964[_0x69841f(0x1f4)]+'\x0a'+_0x638964[_0x69841f(0x1f3)]);}},0x7d0,{'leading':!![]});!(cs[a984_0x452de5(0x1d8)]||cs[a984_0x452de5(0x1e9)])?(process[a984_0x452de5(0x1ee)]('SIGUSR2',async function(){const _0x241b19=a984_0x452de5;await onServerExitHandler(_0x241b19(0x1f0)),process[_0x241b19(0x216)](process[_0x241b19(0x1ef)],_0x241b19(0x1f0));}),process['on'](a984_0x452de5(0x1f7),async function(){const _0x2a4c63=a984_0x452de5;console['log'](_0x2a4c63(0x1fa)),await onServerExitHandler(_0x2a4c63(0x1f7)),process['exit'](0x0);})):process['once'](a984_0x452de5(0x1f7),async function(){const _0x82e374=a984_0x452de5;console[_0x82e374(0x1ec)](_0x82e374(0x212)),await onServerExitHandler(_0x82e374(0x1f7)),process[_0x82e374(0x210)](0x0);});async function main(){const _0x4e9766=a984_0x452de5;try{console[_0x4e9766(0x1ec)](_0x4e9766(0x1f8)+(cs[_0x4e9766(0x1d8)]?'':_0x4e9766(0x20e)));try{await mysqldb['db'][_0x4e9766(0x1eb)][_0x4e9766(0x1fc)]({'logging':cs[_0x4e9766(0x1d8)]||cs[_0x4e9766(0x20f)]==='test'?![]:logDatabase});}catch(_0x550a8f){console[_0x4e9766(0x1e0)]('DB\x20Sync\x20Error:\x0a',_0x550a8f),queryLogger[_0x4e9766(0x1db)](_0x4e9766(0x1ff)+_0x550a8f[_0x4e9766(0x1f4)]+',\x20'+_0x550a8f['stack']);}config[_0x4e9766(0x1e1)]===!![]&&(console['log']('Starting\x20DB\x20seed...'),await seedDB(),console[_0x4e9766(0x1ec)](_0x4e9766(0x1e5)));await checkLicense();const _0x25508b=await rpc[_0x4e9766(0x1ea)]();appLogger[_0x4e9766(0x1fb)](_0x25508b),await chat[_0x4e9766(0x20b)](),await schedule[_0x4e9766(0x20b)]();const _0x4d0e70=await transcribe['start']();appLogger[_0x4e9766(0x1fb)](_0x4d0e70);const _0x5ce0ab=await pm2[_0x4e9766(0x20b)](pm2Config);appLogger[_0x4e9766(0x1fb)](_0x4e9766(0x205),_[_0x4e9766(0x1e3)](_[_0x4e9766(0x211)](_0x5ce0ab,{'status':_0x4e9766(0x1e4)}),'name')[_0x4e9766(0x200)]()),appLogger[_0x4e9766(0x1fb)]('Offline\x20apps:',_[_0x4e9766(0x1e3)](_[_0x4e9766(0x211)](_0x5ce0ab,function(_0x1d49a0){const _0x22f341=_0x4e9766;return _0x1d49a0[_0x22f341(0x20a)]!==_0x22f341(0x1e4);}),_0x4e9766(0x1f5))[_0x4e9766(0x200)]()||_0x4e9766(0x20d)),console[_0x4e9766(0x1ec)](_0x4e9766(0x1df));}catch(_0x277a6e){console[_0x4e9766(0x1db)](_0x277a6e),appLogger[_0x4e9766(0x1db)](_0x4e9766(0x1de),_0x277a6e);throw _0x277a6e;}}main();
\ No newline at end of file
+const a984_0x3e46=['join','message','Redis\x20disconnected','./mysqldb','disconnect','process\x20or\x20namespace\x20not\x20found','listen','close','Rpc\x20closed','filter','delete','status','./rpc','SIGUSR2','App\x20shut\x20down','./rediscache','Database','./config/schedule','seedDB','./config/config.service','sequelize','map','info','apps','Seed\x20DB\x20ok','online','\x0a*****\x20\x20\x20\x20\x20\x20\x20Stopped\x20and\x20removed\x20all\x20subprocesses\x20\x20\x20\x20\x20\x20*****\x0a\x0a\x0a','./config/environment','xCally\x20ready!','isProduction','name','Starting\x20DB\x20seed...','Server\x20failed\x20to\x20start\x20due\x20to\x20error:','environment','Cannot\x20kill\x20','error','./config/license','./config/pm2/config','xCally\x20Starting...\x20','RPC\x20Error','log','start','Error\x20on\x20server\x20exit','stack','warn','kill','Online\x20apps:','Offline\x20apps:','debug','ONCE\x20SIGINT','lodash','Error\x20on\x20server\x20exit:\x20','ON\x20SIGINT','once','\x20signal!\x20\x20\x20\x20\x20\x20\x20\x20*****\x0a','./config/seedDB','exit','./config/schedule/whatsapp','Development\x20Mode','./globals','SIGINT','DB\x20Sync\x20Error:\x20','pid'];(function(_0x552bbd,_0x1c6688){const _0x3e4613=function(_0x353ccc){while(--_0x353ccc){_0x552bbd['push'](_0x552bbd['shift']());}};_0x3e4613(++_0x1c6688);}(a984_0x3e46,0xb0));const a984_0x353c=function(_0x552bbd,_0x1c6688){_0x552bbd=_0x552bbd-0x1e7;let _0x3e4613=a984_0x3e46[_0x552bbd];return _0x3e4613;};const a984_0x2c86c6=a984_0x353c;'use strict';require(a984_0x2c86c6(0x1f0));const mysqldb=require(a984_0x2c86c6(0x1f7)),{RPC}=require(a984_0x2c86c6(0x200)),{getConfigService}=require(a984_0x2c86c6(0x207)),config=require(a984_0x2c86c6(0x20f)),logger=require('./config/logger'),pm2=require('./config/pm2'),pm2Config=require(a984_0x2c86c6(0x219)),schedule=require(a984_0x2c86c6(0x205)),chat=require('./config/schedule/chat'),whatsapp=require(a984_0x2c86c6(0x1ee)),transcribe=require('./config/schedule/transcribe'),{default:seedDB}=require(a984_0x2c86c6(0x1ec)),{default:checkLicense}=require(a984_0x2c86c6(0x218)),{getRedis}=require(a984_0x2c86c6(0x203)),cs=getConfigService(),_=require(a984_0x2c86c6(0x1e7)),appLogger=logger('app'),queryLogger=logger('db-query');function logDatabase(_0x42a12a){const _0x4f937e=a984_0x2c86c6;try{queryLogger[_0x4f937e(0x20a)](_0x4f937e(0x204),_0x42a12a);}catch(_0x296077){console[_0x4f937e(0x217)](_0x296077);}}function onRPCError(_0x48d979){const _0x32205d=a984_0x2c86c6;appLogger[_0x32205d(0x217)](_0x32205d(0x21b),_0x48d979);}const rpc=new RPC(onRPCError),onServerExitHandler=_['debounce'](async function onServerExit(_0x15f8cb){const _0x27351f=a984_0x2c86c6;console[_0x27351f(0x21c)]('\x0a*****\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Caught\x20'+_0x15f8cb+_0x27351f(0x1eb));try{await rpc[_0x27351f(0x1fb)](),appLogger[_0x27351f(0x224)](_0x27351f(0x1fc));for(const _0x4f3f41 of pm2Config[_0x27351f(0x20b)]){try{await pm2[_0x27351f(0x1fe)](_0x4f3f41[_0x27351f(0x212)]),appLogger['debug'](_0x4f3f41[_0x27351f(0x212)]+'\x20deleted');}catch(_0x439b55){_0x439b55[_0x27351f(0x1f5)]!==_0x27351f(0x1f9)&&(console[_0x27351f(0x217)](_0x27351f(0x216)+_0x4f3f41[_0x27351f(0x212)],_0x439b55),appLogger[_0x27351f(0x217)]('Cannot\x20kill\x20'+_0x4f3f41[_0x27351f(0x212)]+':\x20'+_0x439b55[_0x27351f(0x1f5)]+'\x0a'+_0x439b55[_0x27351f(0x21f)]));}}console[_0x27351f(0x21c)](_0x27351f(0x20e)),getRedis()[_0x27351f(0x1f8)](),appLogger[_0x27351f(0x224)](_0x27351f(0x1f6)),appLogger[_0x27351f(0x224)](_0x27351f(0x202));}catch(_0x559b4c){console[_0x27351f(0x217)](_0x27351f(0x21e),_0x559b4c),appLogger[_0x27351f(0x217)](_0x27351f(0x1e8)+_0x559b4c[_0x27351f(0x1f5)]+'\x0a'+_0x559b4c[_0x27351f(0x21f)]);}},0x7d0,{'leading':!![]});!(cs['isProduction']||cs['isTest'])?(process['once']('SIGUSR2',async function(){const _0x131555=a984_0x2c86c6;await onServerExitHandler(_0x131555(0x201)),process[_0x131555(0x221)](process[_0x131555(0x1f3)],_0x131555(0x201));}),process['on'](a984_0x2c86c6(0x1f1),async function(){const _0x8f2a0f=a984_0x2c86c6;console['log'](_0x8f2a0f(0x1e9)),await onServerExitHandler(_0x8f2a0f(0x1f1)),process[_0x8f2a0f(0x1ed)](0x0);})):process[a984_0x2c86c6(0x1ea)]('SIGINT',async function(){const _0x4c3ebd=a984_0x2c86c6;console[_0x4c3ebd(0x21c)](_0x4c3ebd(0x225)),await onServerExitHandler('SIGINT'),process['exit'](0x0);});async function main(){const _0x3bd525=a984_0x2c86c6;try{console[_0x3bd525(0x21c)](_0x3bd525(0x21a)+(cs['isProduction']?'':_0x3bd525(0x1ef)));try{await mysqldb['db'][_0x3bd525(0x208)]['sync']({'logging':cs[_0x3bd525(0x211)]||cs[_0x3bd525(0x215)]==='test'?![]:logDatabase});}catch(_0x56b334){console[_0x3bd525(0x220)]('DB\x20Sync\x20Error:\x0a',_0x56b334),queryLogger['error'](_0x3bd525(0x1f2)+_0x56b334[_0x3bd525(0x1f5)]+',\x20'+_0x56b334['stack']);}config[_0x3bd525(0x206)]===!![]&&(console[_0x3bd525(0x21c)](_0x3bd525(0x213)),await seedDB(),console[_0x3bd525(0x21c)](_0x3bd525(0x20c)));await checkLicense();const _0x253bb0=await rpc[_0x3bd525(0x1fa)]();appLogger[_0x3bd525(0x20a)](_0x253bb0),await chat[_0x3bd525(0x21d)](),await whatsapp[_0x3bd525(0x21d)](),await schedule['start']();const _0x14d7eb=await transcribe[_0x3bd525(0x21d)]();appLogger[_0x3bd525(0x20a)](_0x14d7eb);const _0x14debd=await pm2[_0x3bd525(0x21d)](pm2Config);appLogger[_0x3bd525(0x20a)](_0x3bd525(0x222),_[_0x3bd525(0x209)](_[_0x3bd525(0x1fd)](_0x14debd,{'status':_0x3bd525(0x20d)}),'name')['join']()),appLogger[_0x3bd525(0x20a)](_0x3bd525(0x223),_[_0x3bd525(0x209)](_[_0x3bd525(0x1fd)](_0x14debd,function(_0x549901){const _0x2a3ecb=_0x3bd525;return _0x549901[_0x2a3ecb(0x1ff)]!==_0x2a3ecb(0x20d);}),_0x3bd525(0x212))[_0x3bd525(0x1f4)]()||'None'),console['log'](_0x3bd525(0x210));}catch(_0x3f86fc){console[_0x3bd525(0x217)](_0x3f86fc),appLogger[_0x3bd525(0x217)](_0x3bd525(0x214),_0x3f86fc);throw _0x3f86fc;}}main();
\ No newline at end of file