Built motion from commit 4fa9d4a7.|2.6.31
[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 _0xdf2e=['catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','../../config/logger','api','bluebird','lodash','name','status','send','index','getAllData','then','json'];(function(_0x5a9ec0,_0x1c2b57){var _0x46af3d=function(_0x18fad4){while(--_0x18fad4){_0x5a9ec0['push'](_0x5a9ec0['shift']());}};_0x46af3d(++_0x1c2b57);}(_0xdf2e,0x13a));var _0xedf2=function(_0x1840b1,_0x2d021e){_0x1840b1=_0x1840b1-0x0;var _0x54ee73=_0xdf2e[_0x1840b1];return _0x54ee73;};'use strict';var info=require('systeminformation');var exec=require('child_process')['exec'];var logger=require(_0xedf2('0x0'))(_0xedf2('0x1'));var util=require('util');var BPromise=require(_0xedf2('0x2'));var _=require(_0xedf2('0x3'));function handleError(_0x2bc3a9,_0x112d08,_0x2108b2){_0x112d08=_0x112d08||0x1f4;return function(_0x3f26ad){logger['error']('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x2108b2,_0x112d08,util['inspect'](_0x3f26ad,{'showHidden':![],'depth':null}));delete _0x3f26ad[_0xedf2('0x4')];_0x2bc3a9[_0xedf2('0x5')](_0x112d08)[_0xedf2('0x6')](_0x3f26ad);};}exports[_0xedf2('0x7')]=function(_0x29d1f4,_0x4dc864){return info[_0xedf2('0x8')]()[_0xedf2('0x9')](function(_0x501480){return _0x4dc864[_0xedf2('0x5')](0xc8)[_0xedf2('0xa')](_0x501480);})[_0xedf2('0xb')](function(_0x494858){return _0x4dc864[_0xedf2('0x5')](0x1f4)[_0xedf2('0xa')](_0x494858);});};exports[_0xedf2('0xc')]=function(_0x38da82,_0x53da1b){var _0x67bc9d=[_0xedf2('0xd')];return new BPromise(function(_0x100376,_0xa22ba1){return exec(util[_0xedf2('0xe')](_0xedf2('0xf'),_0x38da82['params'][_0xedf2('0x10')]),function(_0xd01d6,_0x1128d6,_0x5d31c2){if(_0xd01d6){return _0xa22ba1(_0xd01d6);}return _0x100376(_0x1128d6);});})[_0xedf2('0x9')](function(_0xdd0351){var _0x4aee0b=![];var _0x1227b2=_0xdd0351[_0xedf2('0x11')](/\n/);for(var _0x5a6b90=0x0,_0x3df327=_0x67bc9d[_0xedf2('0x12')];_0x5a6b90<_0x3df327,_0x4aee0b===![];_0x5a6b90+=0x1){if(_0xdd0351[_0xedf2('0x13')](_0x67bc9d[_0x5a6b90])>=0x0){_0x4aee0b=!![];}}if(!_0x4aee0b){throw new Error(util[_0xedf2('0xe')](_0xedf2('0x14'),_0x38da82[_0xedf2('0x15')][_0xedf2('0x10')]));}process[_0xedf2('0x16')](_0x38da82[_0xedf2('0x15')][_0xedf2('0x10')],_0xedf2('0x17'));return _0x53da1b['status'](0xc8)['json']({'message':util[_0xedf2('0xe')](_0xedf2('0x18'),_0x38da82[_0xedf2('0x15')][_0xedf2('0x10')])});})[_0xedf2('0xb')](handleError(_0x53da1b,null,_0xedf2('0xc')));};