Built motion from commit d5e4af8c.|2.6.23
[motion2.git] / server / utils / update-app-config.js
index 93a6bdb..aae7ef4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x26c5=['apps','motion2','env','then','readJSON','updated','info','Updating\x20app.json','writeJSON','exports','fs-extra','path','root','resolve','server/app.json','legacy-libs','isArray'];(function(_0x47694e,_0x7b34f1){var _0xaa6cef=function(_0xa25266){while(--_0xa25266){_0x47694e['push'](_0x47694e['shift']());}};_0xaa6cef(++_0x7b34f1);}(_0x26c5,0xd6));var _0x526c=function(_0x5140a4,_0x557d73){_0x5140a4=_0x5140a4-0x0;var _0x37238e=_0x26c5[_0x5140a4];return _0x37238e;};var fs=require(_0x526c('0x0'));var path=require(_0x526c('0x1'));var config=require('../config/environment');var root=config[_0x526c('0x2')];var APP_JSON_PATH=path[_0x526c('0x3')](root,_0x526c('0x4'));var NODEPATH=path[_0x526c('0x3')](root,_0x526c('0x5'));function setLegacyLibsNodeEnvPath(_0x40aaa0){let _0x125255=![];if(Array[_0x526c('0x6')](_0x40aaa0[_0x526c('0x7')])){var _0x2eeaa7=_0x40aaa0['apps']['findIndex'](function(_0x197af8){return _0x197af8['name']===_0x526c('0x8');});if(_0x2eeaa7>-0x1){var _0x1e3684=_0x40aaa0[_0x526c('0x7')][_0x2eeaa7];if(typeof _0x1e3684['env']['NODE_PATH']!=='string'){_0x1e3684[_0x526c('0x9')]['NODE_PATH']=NODEPATH;_0x125255=!![];}}return{'appConfig':_0x40aaa0,'updated':_0x125255};}}function updateAppConfig(_0x3affbc){return fs['pathExists'](APP_JSON_PATH)[_0x526c('0xa')](function(_0x4b6a00){if(_0x4b6a00){return fs[_0x526c('0xb')](APP_JSON_PATH)['then'](function(_0x3366f2){var _0x36398b=setLegacyLibsNodeEnvPath(_0x3366f2);if(_0x36398b[_0x526c('0xc')]){_0x3affbc[_0x526c('0xd')](_0x526c('0xe'));return fs[_0x526c('0xf')](APP_JSON_PATH,_0x3366f2,{'spaces':0x2});}else{return Promise[_0x526c('0x3')]();}});}else{return Promise[_0x526c('0x3')]();}});}module[_0x526c('0x10')]=updateAppConfig;
\ No newline at end of file
+var _0x3ebb=['string','pathExists','then','readJSON','info','Updating\x20app.json','writeJSON','exports','fs-extra','path','../config/environment','root','resolve','legacy-libs','isArray','apps','findIndex','name','motion2','env','NODE_PATH'];(function(_0xf8ca1a,_0xcd834a){var _0x5ac343=function(_0x2d15e6){while(--_0x2d15e6){_0xf8ca1a['push'](_0xf8ca1a['shift']());}};_0x5ac343(++_0xcd834a);}(_0x3ebb,0x86));var _0xb3eb=function(_0x372c49,_0x878312){_0x372c49=_0x372c49-0x0;var _0x5c6161=_0x3ebb[_0x372c49];return _0x5c6161;};var fs=require(_0xb3eb('0x0'));var path=require(_0xb3eb('0x1'));var config=require(_0xb3eb('0x2'));var root=config[_0xb3eb('0x3')];var APP_JSON_PATH=path[_0xb3eb('0x4')](root,'server/app.json');var NODEPATH=path[_0xb3eb('0x4')](root,_0xb3eb('0x5'));function setLegacyLibsNodeEnvPath(_0x44decb){let _0x20f313=![];if(Array[_0xb3eb('0x6')](_0x44decb['apps'])){var _0x4a4bfa=_0x44decb[_0xb3eb('0x7')][_0xb3eb('0x8')](function(_0x1639a3){return _0x1639a3[_0xb3eb('0x9')]===_0xb3eb('0xa');});if(_0x4a4bfa>-0x1){var _0x110e10=_0x44decb[_0xb3eb('0x7')][_0x4a4bfa];if(typeof _0x110e10[_0xb3eb('0xb')][_0xb3eb('0xc')]!==_0xb3eb('0xd')){_0x110e10['env'][_0xb3eb('0xc')]=NODEPATH;_0x20f313=!![];}}return{'appConfig':_0x44decb,'updated':_0x20f313};}}function updateAppConfig(_0x4a1639){return fs[_0xb3eb('0xe')](APP_JSON_PATH)[_0xb3eb('0xf')](function(_0x52d00a){if(_0x52d00a){return fs[_0xb3eb('0x10')](APP_JSON_PATH)['then'](function(_0x25a682){var _0x545bc3=setLegacyLibsNodeEnvPath(_0x25a682);if(_0x545bc3['updated']){_0x4a1639[_0xb3eb('0x11')](_0xb3eb('0x12'));return fs[_0xb3eb('0x13')](APP_JSON_PATH,_0x25a682,{'spaces':0x2});}else{return Promise[_0xb3eb('0x4')]();}});}else{return Promise[_0xb3eb('0x4')]();}});}module[_0xb3eb('0x14')]=updateAppConfig;
\ No newline at end of file