Built motion from commit 10af8726.|2.6.34
[motion2.git] / server / utils / update-app-config.js
index 3581c29..6a929b0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xec70=['name','env','string','NODE_PATH','then','readJSON','info','Updating\x20app.json','writeJSON','exports','fs-extra','path','resolve','server/app.json','legacy-libs','apps'];(function(_0x48263c,_0x257104){var _0x47f899=function(_0x54bfc5){while(--_0x54bfc5){_0x48263c['push'](_0x48263c['shift']());}};_0x47f899(++_0x257104);}(_0xec70,0x1da));var _0x0ec7=function(_0x3beb1f,_0xc0567a){_0x3beb1f=_0x3beb1f-0x0;var _0x7ace5b=_0xec70[_0x3beb1f];return _0x7ace5b;};var fs=require(_0x0ec7('0x0'));var path=require(_0x0ec7('0x1'));var config=require('../config/environment');var root=config['root'];var APP_JSON_PATH=path[_0x0ec7('0x2')](root,_0x0ec7('0x3'));var NODEPATH=path['resolve'](root,_0x0ec7('0x4'));function setLegacyLibsNodeEnvPath(_0x2429a8){let _0x17ac04=![];if(Array['isArray'](_0x2429a8[_0x0ec7('0x5')])){var _0x38eb8e=_0x2429a8[_0x0ec7('0x5')]['findIndex'](function(_0x302f7a){return _0x302f7a[_0x0ec7('0x6')]==='motion2';});if(_0x38eb8e>-0x1){var _0x3cf420=_0x2429a8[_0x0ec7('0x5')][_0x38eb8e];if(typeof _0x3cf420[_0x0ec7('0x7')]['NODE_PATH']!==_0x0ec7('0x8')){_0x3cf420[_0x0ec7('0x7')][_0x0ec7('0x9')]=NODEPATH;_0x17ac04=!![];}}return{'appConfig':_0x2429a8,'updated':_0x17ac04};}}function updateAppConfig(_0x30ac37){return fs['pathExists'](APP_JSON_PATH)[_0x0ec7('0xa')](function(_0x3feebb){if(_0x3feebb){return fs[_0x0ec7('0xb')](APP_JSON_PATH)['then'](function(_0x2e4dd3){var _0x5e4ceb=setLegacyLibsNodeEnvPath(_0x2e4dd3);if(_0x5e4ceb['updated']){_0x30ac37[_0x0ec7('0xc')](_0x0ec7('0xd'));return fs[_0x0ec7('0xe')](APP_JSON_PATH,_0x2e4dd3,{'spaces':0x2});}else{return Promise[_0x0ec7('0x2')]();}});}else{return Promise['resolve']();}});}module[_0x0ec7('0xf')]=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