57c8dfcb72e3d503417c6433f3c830f2c3971378
[motion2.git] / server / api / system / system.controller.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x07e5=['bluebird','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','index','getAllData','then','json','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','length','Process\x20with\x20pid\x20%s\x20not\x20found!','SIGINT','status','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','util'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x07e5,0x133));var _0x507e=function(_0x378e1f,_0x594b9b){_0x378e1f=_0x378e1f-0x0;var _0x581834=_0x07e5[_0x378e1f];return _0x581834;};'use strict';var info=require(_0x507e('0x0'));var exec=require(_0x507e('0x1'))[_0x507e('0x2')];var logger=require(_0x507e('0x3'))('api');var util=require(_0x507e('0x4'));var BPromise=require(_0x507e('0x5'));var _=require('lodash');function handleError(_0x47e4a6,_0x58b538,_0x24c997){_0x58b538=_0x58b538||0x1f4;return function(_0x16112d){logger[_0x507e('0x6')](_0x507e('0x7'),_0x24c997,_0x58b538,util[_0x507e('0x8')](_0x16112d,{'showHidden':![],'depth':null}));delete _0x16112d[_0x507e('0x9')];_0x47e4a6['status'](_0x58b538)['send'](_0x16112d);};}exports[_0x507e('0xa')]=function(_0x3d19,_0x5a403a){return info[_0x507e('0xb')]()[_0x507e('0xc')](function(_0x467dd1){return _0x5a403a['status'](0xc8)[_0x507e('0xd')](_0x467dd1);})['catch'](function(_0x32bf84){return _0x5a403a['status'](0x1f4)['json'](_0x32bf84);});};exports['killProcess']=function(_0x42f628,_0x2ebc2f){var _0x2c94c6=[_0x507e('0xe')];return new BPromise(function(_0x200600,_0x539efc){return exec(util[_0x507e('0xf')](_0x507e('0x10'),_0x42f628[_0x507e('0x11')][_0x507e('0x12')]),function(_0x51e4df,_0x43f732,_0x210fb7){if(_0x51e4df){return _0x539efc(_0x51e4df);}return _0x200600(_0x43f732);});})[_0x507e('0xc')](function(_0x5be3d4){var _0x2a826b=![];var _0xb5385=_0x5be3d4['split'](/\n/);for(var _0x5b925b=0x0,_0x57dac1=_0x2c94c6[_0x507e('0x13')];_0x5b925b<_0x57dac1,_0x2a826b===![];_0x5b925b+=0x1){if(_0x5be3d4['indexOf'](_0x2c94c6[_0x5b925b])>=0x0){_0x2a826b=!![];}}if(!_0x2a826b){throw new Error(util[_0x507e('0xf')](_0x507e('0x14'),_0x42f628[_0x507e('0x11')][_0x507e('0x12')]));}process['kill'](_0x42f628['params']['pid'],_0x507e('0x15'));return _0x2ebc2f[_0x507e('0x16')](0xc8)[_0x507e('0xd')]({'message':util[_0x507e('0xf')](_0x507e('0x17'),_0x42f628[_0x507e('0x11')][_0x507e('0x12')])});})['catch'](handleError(_0x2ebc2f,null,'killProcess'));};