Built motion from commit 4a18b36e645f5fa4a517d36f9783bde259878164. Version 3.0.0...
[motion-next.git] / server / api / version / version.controller.js
index 9c32284..4ea8178 100644 (file)
@@ -1 +1 @@
-const a701_0x1114=['push','join','git\x20reset\x20--hard','json','simple-git','../../mysqldb','catch','motion2','then','2.0.0','restart','git\x20fetch\x20origin\x20master','Your\x20system\x20has\x20been\x20restart\x20successfully','origin','child_process','path','info','umzug','length','sort','replace','root','tags','latest','readdirSync','compare-versions','map','git\x20reset\x20--hard\x20FETCH_HEAD','Database\x20already\x20up-to-date','FETCH_HEAD','reset','.js','constructor','pm2\x20restart\x20motion\x20%s','query','fetch','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','error','migrations','version','lodash','Migration','getQueryInterface','../../config/logger','../../config/environment','sequelize','master','status','../../utils/build-info'];(function(_0x3189cc,_0x1114d9){const _0x1a3793=function(_0xa77f33){while(--_0xa77f33){_0x3189cc['push'](_0x3189cc['shift']());}};_0x1a3793(++_0x1114d9);}(a701_0x1114,0x12c));const a701_0x1a37=function(_0x3189cc,_0x1114d9){_0x3189cc=_0x3189cc-0x0;let _0x1a3793=a701_0x1114[_0x3189cc];return _0x1a3793;};const _0x5f3394=a701_0x1a37;'use strict';const Umzug=require(_0x5f3394('0xb')),path=require(_0x5f3394('0x9')),fs=require('fs'),_=require(_0x5f3394('0x22')),compareVersions=require(_0x5f3394('0x13')),exec=require(_0x5f3394('0x8'))['exec'],db=require(_0x5f3394('0x30'))['db'],config=require(_0x5f3394('0x26')),pm2=require('../../config/pm2'),logger=require(_0x5f3394('0x25'))('update'),{version:packageVersion}=require('../../../package.json'),git=require(_0x5f3394('0x2f'))(config[_0x5f3394('0xf')]),{UniqueConstraintError}=require(_0x5f3394('0x27')),{readBuildInfo}=require(_0x5f3394('0x2a'));async function index(_0xa77f33,_0x46fb3b){const _0x13c6bb=_0x5f3394,_0x45515f=await readBuildInfo(),_0x141fd8={'current':packageVersion,'phonebar':0x2,..._0x45515f};return _0xa77f33[_0x13c6bb('0x1c')]&&_0xa77f33[_0x13c6bb('0x1c')][_0x13c6bb('0x11')]?git[_0x13c6bb('0x1d')]()[_0x13c6bb('0x10')](function(_0x15dd77,_0x1c8650){const _0x5680f4=_0x13c6bb;return _0x141fd8[_0x5680f4('0x11')]=(_0x15dd77?packageVersion:_0x1c8650[_0x5680f4('0x11')])||_0x5680f4('0x3'),_0x46fb3b[_0x5680f4('0x29')](0xc8)[_0x5680f4('0x2e')](_0x141fd8);}):_0x46fb3b['status'](0xc8)[_0x13c6bb('0x2e')](_0x141fd8);}function fetch(_0x43bd61,_0x4c95a1){const _0x301d88=_0x5f3394;return git[_0x301d88('0x1d')]([_0x301d88('0x7'),_0x301d88('0x28')],function(_0x1872f9){const _0x4c9ba6=_0x301d88;if(_0x1872f9)return logger[_0x4c9ba6('0x1f')](_0x1872f9),_0x4c95a1[_0x4c9ba6('0x29')](0x1f4)['json'](_0x1872f9);return logger[_0x4c9ba6('0xa')]('git\x20fetch'),_0x4c95a1[_0x4c9ba6('0x29')](0xc8)[_0x4c9ba6('0x2e')]({'output':_0x4c9ba6('0x5')});});}function reset(_0x5ed1d7,_0x52235c){const _0x1db874=_0x5f3394;return git[_0x1db874('0x18')](['--hard',_0x1db874('0x17')],function(_0x90597d){const _0x322400=_0x1db874;if(_0x90597d)return logger['error'](_0x90597d),_0x52235c['status'](0x1f4)[_0x322400('0x2e')](_0x90597d);return logger[_0x322400('0xa')](_0x322400('0x15')),_0x52235c[_0x322400('0x29')](0xc8)[_0x322400('0x2e')]({'output':_0x322400('0x2d')});});}function pull(_0x381e80,_0x2fe4f2){exec('npm\x20install\x20--production',function(_0xf3c440,_0x40afb1,_0x82873e){const _0x5540af=a701_0x1a37;logger['info'](_0x40afb1),logger[_0x5540af('0xa')](_0x82873e);if(_0xf3c440)return logger[_0x5540af('0x1f')](_0xf3c440),_0x2fe4f2[_0x5540af('0x29')](0x1f4)['json'](_0xf3c440);return _0x2fe4f2[_0x5540af('0x29')](0xc8)[_0x5540af('0x2e')]({'output':_0x40afb1});});}function restart(_0x2bc9e2,_0x2cdeeb){const _0x4e8f97=_0x5f3394;return pm2[_0x4e8f97('0x4')](_0x4e8f97('0x1'))[_0x4e8f97('0x2')](function(_0x2fee33){const _0x36e341=_0x4e8f97;return logger[_0x36e341('0xa')](_0x36e341('0x1b'),_0x2fee33),_0x2cdeeb[_0x36e341('0x29')](0xc8)[_0x36e341('0x2e')]({'output':_0x36e341('0x6')});})[_0x4e8f97('0x0')](function(_0x2450dc){const _0x27be52=_0x4e8f97;return logger['error'](_0x2450dc),_0x2cdeeb[_0x27be52('0x29')](0x1f4)[_0x27be52('0x2e')](_0x2450dc);});}function migrations(_0x4ec9c1,_0x3ecff8){const _0xed6344=_0x5f3394,_0x5c940d=fs[_0xed6344('0x12')](path[_0xed6344('0x2c')](config['root'],_0xed6344('0x20'))),_0x16029f=[];for(let _0x5f5da0=0x0;_0x5f5da0<_0x5c940d['length'];_0x5f5da0++){const _0x27dd49=_0x5c940d[_0x5f5da0][_0xed6344('0xe')](_0xed6344('0x19'),'');compareVersions(packageVersion,_0x27dd49)===-0x1&&_0x16029f[_0xed6344('0x2b')](_0x27dd49);}if(_0x16029f[_0xed6344('0xc')]){const _0x321a43=_0x16029f[_0xed6344('0xd')](compareVersions),_0x61de56=new Umzug({'storage':_0xed6344('0x27'),'storageOptions':{'model':db[_0xed6344('0x23')],'modelName':_0xed6344('0x23'),'columnName':_0xed6344('0x21')},'migrations':{'params':[db['sequelize'][_0xed6344('0x24')](),db['sequelize'][_0xed6344('0x1a')],function(){const _0x7100a1=_0xed6344;throw new Error(_0x7100a1('0x1e'));}],'path':path[_0xed6344('0x2c')](config[_0xed6344('0xf')],_0xed6344('0x20')),'pattern':/\.js$/}});_0x61de56['up']({'migrations':_[_0xed6344('0x14')](_0x321a43,function(_0xafd938){const _0x58e7c6=_0xed6344;return _0xafd938+_0x58e7c6('0x19');})})[_0xed6344('0x2')](function(){const _0x49853a=_0xed6344;return _0x3ecff8[_0x49853a('0x29')](0xc8)[_0x49853a('0x2e')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+packageVersion+'\x20to\x20'+_['last'](_0x321a43),'migrations':_[_0x49853a('0x2c')](_0x321a43)});})[_0xed6344('0x0')](function(_0x1eba19){const _0x15d34f=_0xed6344;return _0x1eba19 instanceof UniqueConstraintError?_0x3ecff8['status'](0xc8)[_0x15d34f('0x2e')]({'output':_0x15d34f('0x16')}):_0x3ecff8[_0x15d34f('0x29')](0x1f4)[_0x15d34f('0x2e')](_0x1eba19);});}else return _0x3ecff8['status'](0xc8)[_0xed6344('0x2e')]({'output':_0xed6344('0x16')});}module['exports']={'index':index,'fetch':fetch,'migrations':migrations,'pull':pull,'reset':reset,'restart':restart};
\ No newline at end of file
+const a701_0x399c=['sequelize','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','git\x20fetch','query','motion2','--hard','../../config/logger','\x20to\x20','compare-versions','latest','status','sort','../../utils/build-info','error','../../config/pm2','Migration','path','Database\x20migrated\x20successfully\x20from\x20version\x20','constructor','info','2.0.0','tags','pm2\x20restart\x20motion\x20%s','length','simple-git','migrations','update','npm\x20install\x20--production','../../../package.json','umzug','exec','json','../../mysqldb','restart','fetch','git\x20fetch\x20origin\x20master','push','replace','join','root','catch','Database\x20already\x20up-to-date','../../config/environment','origin','map','FETCH_HEAD'];(function(_0x30e091,_0x399c06){const _0x5e6f8f=function(_0x42c178){while(--_0x42c178){_0x30e091['push'](_0x30e091['shift']());}};_0x5e6f8f(++_0x399c06);}(a701_0x399c,0x1c7));const a701_0x5e6f=function(_0x30e091,_0x399c06){_0x30e091=_0x30e091-0x0;let _0x5e6f8f=a701_0x399c[_0x30e091];return _0x5e6f8f;};const _0x5334ae=a701_0x5e6f;'use strict';const Umzug=require(_0x5334ae('0x22')),path=require(_0x5334ae('0x15')),fs=require('fs'),_=require('lodash'),compareVersions=require(_0x5334ae('0xd')),exec=require('child_process')[_0x5334ae('0x23')],db=require(_0x5334ae('0x25'))['db'],config=require(_0x5334ae('0x1')),pm2=require(_0x5334ae('0x13')),logger=require(_0x5334ae('0xb'))(_0x5334ae('0x1f')),{version:packageVersion}=require(_0x5334ae('0x21')),git=require(_0x5334ae('0x1d'))(config[_0x5334ae('0x2c')]),{UniqueConstraintError}=require('sequelize'),{readBuildInfo}=require(_0x5334ae('0x11'));async function index(_0x42c178,_0x285801){const _0x5d6972=_0x5334ae,_0x4f0669=await readBuildInfo(),_0x2468f7={'current':packageVersion,'phonebar':0x2,..._0x4f0669};return _0x42c178['query']&&_0x42c178[_0x5d6972('0x8')][_0x5d6972('0xe')]?git[_0x5d6972('0x27')]()[_0x5d6972('0x1a')](function(_0x2c7cda,_0x4182e1){const _0x4c9238=_0x5d6972;return _0x2468f7[_0x4c9238('0xe')]=(_0x2c7cda?packageVersion:_0x4182e1[_0x4c9238('0xe')])||_0x4c9238('0x19'),_0x285801[_0x4c9238('0xf')](0xc8)[_0x4c9238('0x24')](_0x2468f7);}):_0x285801[_0x5d6972('0xf')](0xc8)[_0x5d6972('0x24')](_0x2468f7);}function fetch(_0x1a591d,_0x57b354){const _0x361a6e=_0x5334ae;return git[_0x361a6e('0x27')]([_0x361a6e('0x2'),'master'],function(_0x2e761e){const _0x5c8ca2=_0x361a6e;if(_0x2e761e)return logger[_0x5c8ca2('0x12')](_0x2e761e),_0x57b354[_0x5c8ca2('0xf')](0x1f4)[_0x5c8ca2('0x24')](_0x2e761e);return logger['info'](_0x5c8ca2('0x7')),_0x57b354[_0x5c8ca2('0xf')](0xc8)[_0x5c8ca2('0x24')]({'output':_0x5c8ca2('0x28')});});}function reset(_0x54907d,_0x337b25){const _0x5c8974=_0x5334ae;return git['reset']([_0x5c8974('0xa'),_0x5c8974('0x4')],function(_0x4a9978){const _0x1f9bc2=_0x5c8974;if(_0x4a9978)return logger['error'](_0x4a9978),_0x337b25[_0x1f9bc2('0xf')](0x1f4)[_0x1f9bc2('0x24')](_0x4a9978);return logger[_0x1f9bc2('0x18')]('git\x20reset\x20--hard\x20FETCH_HEAD'),_0x337b25[_0x1f9bc2('0xf')](0xc8)[_0x1f9bc2('0x24')]({'output':'git\x20reset\x20--hard'});});}function pull(_0x5efb1b,_0x323ca1){const _0x11ca29=_0x5334ae;exec(_0x11ca29('0x20'),function(_0x3cb688,_0x26db0f,_0x57d170){const _0x36154b=_0x11ca29;logger['info'](_0x26db0f),logger[_0x36154b('0x18')](_0x57d170);if(_0x3cb688)return logger[_0x36154b('0x12')](_0x3cb688),_0x323ca1[_0x36154b('0xf')](0x1f4)[_0x36154b('0x24')](_0x3cb688);return _0x323ca1[_0x36154b('0xf')](0xc8)[_0x36154b('0x24')]({'output':_0x26db0f});});}function restart(_0xc67d89,_0x57f1c3){const _0x255738=_0x5334ae;return pm2[_0x255738('0x26')](_0x255738('0x9'))['then'](function(_0x39ef30){const _0x46c4d6=_0x255738;return logger[_0x46c4d6('0x18')](_0x46c4d6('0x1b'),_0x39ef30),_0x57f1c3['status'](0xc8)[_0x46c4d6('0x24')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x255738('0x2d')](function(_0x3e055b){const _0x1272c7=_0x255738;return logger['error'](_0x3e055b),_0x57f1c3[_0x1272c7('0xf')](0x1f4)[_0x1272c7('0x24')](_0x3e055b);});}function migrations(_0x53f27c,_0xc9a932){const _0x2b889f=_0x5334ae,_0x5c2c42=fs['readdirSync'](path[_0x2b889f('0x2b')](config[_0x2b889f('0x2c')],'migrations')),_0x2e1726=[];for(let _0x2b4bd2=0x0;_0x2b4bd2<_0x5c2c42[_0x2b889f('0x1c')];_0x2b4bd2++){const _0x1fb675=_0x5c2c42[_0x2b4bd2][_0x2b889f('0x2a')]('.js','');compareVersions(packageVersion,_0x1fb675)===-0x1&&_0x2e1726[_0x2b889f('0x29')](_0x1fb675);}if(_0x2e1726['length']){const _0x1b6471=_0x2e1726[_0x2b889f('0x10')](compareVersions),_0x512938=new Umzug({'storage':_0x2b889f('0x5'),'storageOptions':{'model':db[_0x2b889f('0x14')],'modelName':'Migration','columnName':'version'},'migrations':{'params':[db[_0x2b889f('0x5')]['getQueryInterface'](),db[_0x2b889f('0x5')][_0x2b889f('0x17')],function(){const _0x49ecf4=_0x2b889f;throw new Error(_0x49ecf4('0x6'));}],'path':path[_0x2b889f('0x2b')](config['root'],_0x2b889f('0x1e')),'pattern':/\.js$/}});_0x512938['up']({'migrations':_[_0x2b889f('0x3')](_0x1b6471,function(_0x26576b){return _0x26576b+'.js';})})['then'](function(){const _0x543875=_0x2b889f;return _0xc9a932[_0x543875('0xf')](0xc8)[_0x543875('0x24')]({'output':_0x543875('0x16')+packageVersion+_0x543875('0xc')+_['last'](_0x1b6471),'migrations':_[_0x543875('0x2b')](_0x1b6471)});})[_0x2b889f('0x2d')](function(_0xcaf338){const _0x31300b=_0x2b889f;return _0xcaf338 instanceof UniqueConstraintError?_0xc9a932['status'](0xc8)[_0x31300b('0x24')]({'output':_0x31300b('0x0')}):_0xc9a932[_0x31300b('0xf')](0x1f4)['json'](_0xcaf338);});}else return _0xc9a932['status'](0xc8)[_0x2b889f('0x24')]({'output':'Database\x20already\x20up-to-date'});}module['exports']={'index':index,'fetch':fetch,'migrations':migrations,'pull':pull,'reset':reset,'restart':restart};
\ No newline at end of file