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 _0x393e=['findIndex','name','motion2','env','NODE_PATH','string','readJSON','then','updated','info','Updating\x20app.json','exports','fs-extra','path','root','server/app.json','resolve','legacy-libs','apps'];(function(_0x5f582e,_0x4112b7){var _0x437430=function(_0x393a6b){while(--_0x393a6b){_0x5f582e['push'](_0x5f582e['shift']());}};_0x437430(++_0x4112b7);}(_0x393e,0x175));var _0xe393=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x393e[_0x3070dc];return _0x431489;};var fs=require(_0xe393('0x0'));var path=require(_0xe393('0x1'));var config=require('../config/environment');var root=config[_0xe393('0x2')];var APP_JSON_PATH=path['resolve'](root,_0xe393('0x3'));var NODEPATH=path[_0xe393('0x4')](root,_0xe393('0x5'));function setLegacyLibsNodeEnvPath(_0x6ad2da){let _0x3038db=![];if(Array['isArray'](_0x6ad2da['apps'])){var _0xb937ab=_0x6ad2da[_0xe393('0x6')][_0xe393('0x7')](function(_0x28be30){return _0x28be30[_0xe393('0x8')]===_0xe393('0x9');});if(_0xb937ab>-0x1){var _0x399f8e=_0x6ad2da[_0xe393('0x6')][_0xb937ab];if(typeof _0x399f8e[_0xe393('0xa')][_0xe393('0xb')]!==_0xe393('0xc')){_0x399f8e['env']['NODE_PATH']=NODEPATH;_0x3038db=!![];}}return{'appConfig':_0x6ad2da,'updated':_0x3038db};}}function updateAppConfig(_0x57c094){return fs['pathExists'](APP_JSON_PATH)['then'](function(_0x5c640c){if(_0x5c640c){return fs[_0xe393('0xd')](APP_JSON_PATH)[_0xe393('0xe')](function(_0x1d9eea){var _0x1cfc94=setLegacyLibsNodeEnvPath(_0x1d9eea);if(_0x1cfc94[_0xe393('0xf')]){_0x57c094[_0xe393('0x10')](_0xe393('0x11'));return fs['writeJSON'](APP_JSON_PATH,_0x1d9eea,{'spaces':0x2});}else{return Promise[_0xe393('0x4')]();}});}else{return Promise[_0xe393('0x4')]();}});}module[_0xe393('0x12')]=updateAppConfig;