Built motion from commit 10af8726.|2.6.34
[motion2.git] / server / utils / update-app-config.js
index e420374..6a929b0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x35c7=['apps','findIndex','name','motion2','NODE_PATH','env','then','readJSON','updated','info','Updating\x20app.json','exports','path','../config/environment','root','resolve','server/app.json'];(function(_0x4d3924,_0x58f044){var _0x38f8d4=function(_0x5c42cf){while(--_0x5c42cf){_0x4d3924['push'](_0x4d3924['shift']());}};_0x38f8d4(++_0x58f044);}(_0x35c7,0xb6));var _0x735c=function(_0x51ccd1,_0x4db52d){_0x51ccd1=_0x51ccd1-0x0;var _0x327b4e=_0x35c7[_0x51ccd1];return _0x327b4e;};var fs=require('fs-extra');var path=require(_0x735c('0x0'));var config=require(_0x735c('0x1'));var root=config[_0x735c('0x2')];var APP_JSON_PATH=path[_0x735c('0x3')](root,_0x735c('0x4'));var NODEPATH=path[_0x735c('0x3')](root,'legacy-libs');function setLegacyLibsNodeEnvPath(_0x4ebd37){let _0x2804e9=![];if(Array['isArray'](_0x4ebd37[_0x735c('0x5')])){var _0x43f9c9=_0x4ebd37['apps'][_0x735c('0x6')](function(_0x3ac7e0){return _0x3ac7e0[_0x735c('0x7')]===_0x735c('0x8');});if(_0x43f9c9>-0x1){var _0x33bc38=_0x4ebd37[_0x735c('0x5')][_0x43f9c9];if(typeof _0x33bc38['env'][_0x735c('0x9')]!=='string'){_0x33bc38[_0x735c('0xa')]['NODE_PATH']=NODEPATH;_0x2804e9=!![];}}return{'appConfig':_0x4ebd37,'updated':_0x2804e9};}}function updateAppConfig(_0x23957e){return fs['pathExists'](APP_JSON_PATH)[_0x735c('0xb')](function(_0x55f923){if(_0x55f923){return fs[_0x735c('0xc')](APP_JSON_PATH)['then'](function(_0x48ee70){var _0x15dc38=setLegacyLibsNodeEnvPath(_0x48ee70);if(_0x15dc38[_0x735c('0xd')]){_0x23957e[_0x735c('0xe')](_0x735c('0xf'));return fs['writeJSON'](APP_JSON_PATH,_0x48ee70,{'spaces':0x2});}else{return Promise[_0x735c('0x3')]();}});}else{return Promise[_0x735c('0x3')]();}});}module[_0x735c('0x10')]=updateAppConfig;
\ No newline at end of file
+var _0x5fae=['then','readJSON','updated','info','Updating\x20app.json','writeJSON','exports','../config/environment','root','resolve','server/app.json','legacy-libs','isArray','apps','findIndex','name','env'];(function(_0x5b8f70,_0x4afa65){var _0x4116b9=function(_0x25b7dd){while(--_0x25b7dd){_0x5b8f70['push'](_0x5b8f70['shift']());}};_0x4116b9(++_0x4afa65);}(_0x5fae,0x1f4));var _0xe5fa=function(_0x2f4ef3,_0x58502e){_0x2f4ef3=_0x2f4ef3-0x0;var _0x3cc512=_0x5fae[_0x2f4ef3];return _0x3cc512;};var fs=require('fs-extra');var path=require('path');var config=require(_0xe5fa('0x0'));var root=config[_0xe5fa('0x1')];var APP_JSON_PATH=path[_0xe5fa('0x2')](root,_0xe5fa('0x3'));var NODEPATH=path[_0xe5fa('0x2')](root,_0xe5fa('0x4'));function setLegacyLibsNodeEnvPath(_0x277a14){let _0x56ac6c=![];if(Array[_0xe5fa('0x5')](_0x277a14[_0xe5fa('0x6')])){var _0x112805=_0x277a14[_0xe5fa('0x6')][_0xe5fa('0x7')](function(_0x55d3a7){return _0x55d3a7[_0xe5fa('0x8')]==='motion2';});if(_0x112805>-0x1){var _0x1c3010=_0x277a14[_0xe5fa('0x6')][_0x112805];if(typeof _0x1c3010[_0xe5fa('0x9')]['NODE_PATH']!=='string'){_0x1c3010[_0xe5fa('0x9')]['NODE_PATH']=NODEPATH;_0x56ac6c=!![];}}return{'appConfig':_0x277a14,'updated':_0x56ac6c};}}function updateAppConfig(_0xced24f){return fs['pathExists'](APP_JSON_PATH)[_0xe5fa('0xa')](function(_0x4d7b7a){if(_0x4d7b7a){return fs[_0xe5fa('0xb')](APP_JSON_PATH)[_0xe5fa('0xa')](function(_0x60279f){var _0x62beed=setLegacyLibsNodeEnvPath(_0x60279f);if(_0x62beed[_0xe5fa('0xc')]){_0xced24f[_0xe5fa('0xd')](_0xe5fa('0xe'));return fs[_0xe5fa('0xf')](APP_JSON_PATH,_0x60279f,{'spaces':0x2});}else{return Promise[_0xe5fa('0x2')]();}});}else{return Promise[_0xe5fa('0x2')]();}});}module[_0xe5fa('0x10')]=updateAppConfig;
\ No newline at end of file