Built motion from commit 3d3e98f2.|2.6.29
[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 _0xe6df=['Process\x20with\x20pid\x20%s\x20not\x20found!','kill','params','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','exec','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','status','send','index','then','json','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','split','length','indexOf'];(function(_0x480b30,_0x47c427){var _0x234122=function(_0x4521e0){while(--_0x4521e0){_0x480b30['push'](_0x480b30['shift']());}};_0x234122(++_0x47c427);}(_0xe6df,0x10e));var _0xfe6d=function(_0x209e49,_0x1f636b){_0x209e49=_0x209e49-0x0;var _0x3ba0c9=_0xe6df[_0x209e49];return _0x3ba0c9;};'use strict';var info=require('systeminformation');var exec=require('child_process')[_0xfe6d('0x0')];var logger=require('../../config/logger')('api');var util=require('util');var BPromise=require('bluebird');var _=require(_0xfe6d('0x1'));function handleError(_0x4ee0f8,_0x1c9d5d,_0x4f2e05){_0x1c9d5d=_0x1c9d5d||0x1f4;return function(_0xcfbd82){logger[_0xfe6d('0x2')](_0xfe6d('0x3'),_0x4f2e05,_0x1c9d5d,util['inspect'](_0xcfbd82,{'showHidden':![],'depth':null}));delete _0xcfbd82[_0xfe6d('0x4')];_0x4ee0f8[_0xfe6d('0x5')](_0x1c9d5d)[_0xfe6d('0x6')](_0xcfbd82);};}exports[_0xfe6d('0x7')]=function(_0x308fe1,_0x1c0407){return info['getAllData']()[_0xfe6d('0x8')](function(_0x25045d){return _0x1c0407[_0xfe6d('0x5')](0xc8)['json'](_0x25045d);})['catch'](function(_0x2e3b77){return _0x1c0407[_0xfe6d('0x5')](0x1f4)[_0xfe6d('0x9')](_0x2e3b77);});};exports[_0xfe6d('0xa')]=function(_0x25780d,_0x349207){var _0x580089=[_0xfe6d('0xb')];return new BPromise(function(_0x272631,_0x5751c7){return exec(util[_0xfe6d('0xc')](_0xfe6d('0xd'),_0x25780d['params'][_0xfe6d('0xe')]),function(_0x4e6b48,_0x2bb107,_0x45b2bf){if(_0x4e6b48){return _0x5751c7(_0x4e6b48);}return _0x272631(_0x2bb107);});})[_0xfe6d('0x8')](function(_0x63ac1d){var _0x209773=![];var _0x3f3ea7=_0x63ac1d[_0xfe6d('0xf')](/\n/);for(var _0x1206cc=0x0,_0xaceb23=_0x580089[_0xfe6d('0x10')];_0x1206cc<_0xaceb23,_0x209773===![];_0x1206cc+=0x1){if(_0x63ac1d[_0xfe6d('0x11')](_0x580089[_0x1206cc])>=0x0){_0x209773=!![];}}if(!_0x209773){throw new Error(util[_0xfe6d('0xc')](_0xfe6d('0x12'),_0x25780d['params'][_0xfe6d('0xe')]));}process[_0xfe6d('0x13')](_0x25780d[_0xfe6d('0x14')][_0xfe6d('0xe')],_0xfe6d('0x15'));return _0x349207[_0xfe6d('0x5')](0xc8)[_0xfe6d('0x9')]({'message':util['format'](_0xfe6d('0x16'),_0x25780d[_0xfe6d('0x14')][_0xfe6d('0xe')])});})[_0xfe6d('0x17')](handleError(_0x349207,null,_0xfe6d('0xa')));};