dab8420708b9d02b8bfdca165964e730c96810e5
[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 _0xd664=['kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','util','bluebird','error','inspect','name','status','send','index','getAllData','then','json','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'];(function(_0x28611e,_0x586726){var _0x530f69=function(_0x407906){while(--_0x407906){_0x28611e['push'](_0x28611e['shift']());}};_0x530f69(++_0x586726);}(_0xd664,0xa5));var _0x4d66=function(_0x376190,_0x2fc049){_0x376190=_0x376190-0x0;var _0x463f35=_0xd664[_0x376190];return _0x463f35;};'use strict';var info=require(_0x4d66('0x0'));var exec=require(_0x4d66('0x1'))['exec'];var logger=require('../../config/logger')('api');var util=require(_0x4d66('0x2'));var BPromise=require(_0x4d66('0x3'));var _=require('lodash');function handleError(_0x48fd1a,_0x335a49,_0x3f5a6e){_0x335a49=_0x335a49||0x1f4;return function(_0x3806ad){logger[_0x4d66('0x4')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x3f5a6e,_0x335a49,util[_0x4d66('0x5')](_0x3806ad,{'showHidden':![],'depth':null}));delete _0x3806ad[_0x4d66('0x6')];_0x48fd1a[_0x4d66('0x7')](_0x335a49)[_0x4d66('0x8')](_0x3806ad);};}exports[_0x4d66('0x9')]=function(_0x2eb5b6,_0x434138){return info[_0x4d66('0xa')]()[_0x4d66('0xb')](function(_0xe200ed){return _0x434138['status'](0xc8)[_0x4d66('0xc')](_0xe200ed);})[_0x4d66('0xd')](function(_0xa0d547){return _0x434138[_0x4d66('0x7')](0x1f4)[_0x4d66('0xc')](_0xa0d547);});};exports[_0x4d66('0xe')]=function(_0x3da8ec,_0x19900d){var _0x32c6ba=[_0x4d66('0xf')];return new BPromise(function(_0x3e47f6,_0x3b8214){return exec(util[_0x4d66('0x10')](_0x4d66('0x11'),_0x3da8ec['params'][_0x4d66('0x12')]),function(_0x5e1de3,_0x175519,_0x3624db){if(_0x5e1de3){return _0x3b8214(_0x5e1de3);}return _0x3e47f6(_0x175519);});})[_0x4d66('0xb')](function(_0x4b647b){var _0x2aaf2b=![];var _0x3d3cda=_0x4b647b[_0x4d66('0x13')](/\n/);for(var _0x4f0150=0x0,_0xbd27f2=_0x32c6ba[_0x4d66('0x14')];_0x4f0150<_0xbd27f2,_0x2aaf2b===![];_0x4f0150+=0x1){if(_0x4b647b[_0x4d66('0x15')](_0x32c6ba[_0x4f0150])>=0x0){_0x2aaf2b=!![];}}if(!_0x2aaf2b){throw new Error(util['format'](_0x4d66('0x16'),_0x3da8ec[_0x4d66('0x17')][_0x4d66('0x12')]));}process[_0x4d66('0x18')](_0x3da8ec[_0x4d66('0x17')][_0x4d66('0x12')],_0x4d66('0x19'));return _0x19900d[_0x4d66('0x7')](0xc8)[_0x4d66('0xc')]({'message':util['format'](_0x4d66('0x1a'),_0x3da8ec[_0x4d66('0x17')][_0x4d66('0x12')])});})[_0x4d66('0xd')](handleError(_0x19900d,null,_0x4d66('0xe')));};