1 // *************************************************************************
3 // * xCALLY Motion - The Omnichannel Contact Center *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved *
6 // *************************************************************************
8 // * Email: info@xcally.com *
9 // * Website: https://www.xcally.com *
11 // *************************************************************************
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. *
17 // *************************************************************************
18 var _0x9a89=['env','pathExists','updated','info','Updating\x20app.json','writeJSON','exports','fs-extra','path','server/app.json','resolve','legacy-libs','apps','findIndex','name','motion2'];(function(_0x974647,_0xf684f5){var _0x1461bf=function(_0x4beba1){while(--_0x4beba1){_0x974647['push'](_0x974647['shift']());}};_0x1461bf(++_0xf684f5);}(_0x9a89,0x107));var _0x99a8=function(_0x27f62c,_0x565542){_0x27f62c=_0x27f62c-0x0;var _0x3ad820=_0x9a89[_0x27f62c];return _0x3ad820;};var fs=require(_0x99a8('0x0'));var path=require(_0x99a8('0x1'));var config=require('../config/environment');var root=config['root'];var APP_JSON_PATH=path['resolve'](root,_0x99a8('0x2'));var NODEPATH=path[_0x99a8('0x3')](root,_0x99a8('0x4'));function setLegacyLibsNodeEnvPath(_0x262a51){let _0x5ad4f6=![];if(Array['isArray'](_0x262a51[_0x99a8('0x5')])){var _0x29eb4f=_0x262a51[_0x99a8('0x5')][_0x99a8('0x6')](function(_0x18c116){return _0x18c116[_0x99a8('0x7')]===_0x99a8('0x8');});if(_0x29eb4f>-0x1){var _0x3f09cb=_0x262a51[_0x99a8('0x5')][_0x29eb4f];if(typeof _0x3f09cb[_0x99a8('0x9')]['NODE_PATH']!=='string'){_0x3f09cb[_0x99a8('0x9')]['NODE_PATH']=NODEPATH;_0x5ad4f6=!![];}}return{'appConfig':_0x262a51,'updated':_0x5ad4f6};}}function updateAppConfig(_0x24da78){return fs[_0x99a8('0xa')](APP_JSON_PATH)['then'](function(_0x4b602a){if(_0x4b602a){return fs['readJSON'](APP_JSON_PATH)['then'](function(_0x5b01ac){var _0x463bd1=setLegacyLibsNodeEnvPath(_0x5b01ac);if(_0x463bd1[_0x99a8('0xb')]){_0x24da78[_0x99a8('0xc')](_0x99a8('0xd'));return fs[_0x99a8('0xe')](APP_JSON_PATH,_0x5b01ac,{'spaces':0x2});}else{return Promise['resolve']();}});}else{return Promise['resolve']();}});}module[_0x99a8('0xf')]=updateAppConfig;