7122114f69eb928e76dd028efb30948477bbafa6
[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 _0xeabe=['SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','../../config/logger','api','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','status','send','index','then','catch','killProcess','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xeabe,0x12d));var _0xeeab=function(_0x435049,_0x1c5f97){_0x435049=_0x435049-0x0;var _0x519ffe=_0xeabe[_0x435049];return _0x519ffe;};'use strict';var info=require('systeminformation');var exec=require('child_process')['exec'];var logger=require(_0xeeab('0x0'))(_0xeeab('0x1'));var util=require('util');var BPromise=require(_0xeeab('0x2'));var _=require(_0xeeab('0x3'));function handleError(_0x44da89,_0x18e71b,_0x9bae77){_0x18e71b=_0x18e71b||0x1f4;return function(_0x125b35){logger[_0xeeab('0x4')](_0xeeab('0x5'),_0x9bae77,_0x18e71b,util['inspect'](_0x125b35,{'showHidden':![],'depth':null}));delete _0x125b35[_0xeeab('0x6')];_0x44da89[_0xeeab('0x7')](_0x18e71b)[_0xeeab('0x8')](_0x125b35);};}exports[_0xeeab('0x9')]=function(_0x59ee4c,_0x3625b6){return info['getAllData']()[_0xeeab('0xa')](function(_0x1d7303){return _0x3625b6[_0xeeab('0x7')](0xc8)['json'](_0x1d7303);})[_0xeeab('0xb')](function(_0x29c10f){return _0x3625b6['status'](0x1f4)['json'](_0x29c10f);});};exports[_0xeeab('0xc')]=function(_0x38418c,_0x433dae){var _0x2cf99a=['components/import/cm'];return new BPromise(function(_0x5f0785,_0x3410af){return exec(util[_0xeeab('0xd')](_0xeeab('0xe'),_0x38418c[_0xeeab('0xf')][_0xeeab('0x10')]),function(_0x353b63,_0x8c51ed,_0x723897){if(_0x353b63){return _0x3410af(_0x353b63);}return _0x5f0785(_0x8c51ed);});})[_0xeeab('0xa')](function(_0x29412d){var _0x4191f0=![];var _0x1c0952=_0x29412d[_0xeeab('0x11')](/\n/);for(var _0x13d0b5=0x0,_0x2a6436=_0x2cf99a[_0xeeab('0x12')];_0x13d0b5<_0x2a6436,_0x4191f0===![];_0x13d0b5+=0x1){if(_0x29412d[_0xeeab('0x13')](_0x2cf99a[_0x13d0b5])>=0x0){_0x4191f0=!![];}}if(!_0x4191f0){throw new Error(util[_0xeeab('0xd')](_0xeeab('0x14'),_0x38418c['params'][_0xeeab('0x10')]));}process['kill'](_0x38418c['params'][_0xeeab('0x10')],_0xeeab('0x15'));return _0x433dae[_0xeeab('0x7')](0xc8)['json']({'message':util['format'](_0xeeab('0x16'),_0x38418c[_0xeeab('0xf')][_0xeeab('0x10')])});})[_0xeeab('0xb')](handleError(_0x433dae,null,_0xeeab('0xc')));};