Built motion from commit cb845558.|2.6.34
[motion2.git] / server / api / version / version.controller.js
index 3bbcc75..4b264e1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x607a=['motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','join','length','replace','.js','version','push','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','server','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','Database\x20already\x20up-to-date','umzug','path','compare-versions','child_process','exec','../../config/environment','../../config/pm2','../../config/logger','update','root','exports','query','latest','fetch','tags','2.0.0','status','json','origin','error','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','info','git\x20reset\x20--hard\x20FETCH_HEAD','pull','npm\x20install\x20--production','restart'];(function(_0x531a94,_0xbf2864){var _0x4ad3e1=function(_0x5e98b4){while(--_0x5e98b4){_0x531a94['push'](_0x531a94['shift']());}};_0x4ad3e1(++_0xbf2864);}(_0x607a,0x192));var _0xa607=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x607a[_0x4b369d];return _0x571a98;};'use strict';var Umzug=require(_0xa607('0x0'));var path=require(_0xa607('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require('pkginfo')(module,'version');var compareVersions=require(_0xa607('0x2'));var exec=require(_0xa607('0x3'))[_0xa607('0x4')];var db=require('../../mysqldb')['db'];var config=require(_0xa607('0x5'));var pm2=require(_0xa607('0x6'));var logger=require(_0xa607('0x7'))(_0xa607('0x8'));var git=require('simple-git')(config[_0xa607('0x9')]);exports['index']=function(_0x485a1b,_0x12f8ab){var _0x2a9368={'current':module[_0xa607('0xa')]['version'],'phonebar':0x2};if(_0x485a1b[_0xa607('0xb')]&&_0x485a1b['query'][_0xa607('0xc')]){return git[_0xa607('0xd')]()[_0xa607('0xe')](function(_0x3e6c8d,_0x1abffd){_0x2a9368[_0xa607('0xc')]=(_0x3e6c8d?module[_0xa607('0xa')]['version']:_0x1abffd[_0xa607('0xc')])||_0xa607('0xf');return _0x12f8ab[_0xa607('0x10')](0xc8)[_0xa607('0x11')](_0x2a9368);});}else{return _0x12f8ab[_0xa607('0x10')](0xc8)['json'](_0x2a9368);}};exports[_0xa607('0xd')]=function(_0x35d69f,_0x1ba210){return git[_0xa607('0xd')]([_0xa607('0x12'),'master'],function(_0x185010){if(_0x185010){logger[_0xa607('0x13')](_0x185010);return _0x1ba210[_0xa607('0x10')](0x1f4)[_0xa607('0x11')](_0x185010);}logger['info'](_0xa607('0x14'));return _0x1ba210[_0xa607('0x10')](0xc8)[_0xa607('0x11')]({'output':_0xa607('0x15')});});};exports[_0xa607('0x16')]=function(_0x160e7b,_0x315657){return git[_0xa607('0x16')]([_0xa607('0x17'),_0xa607('0x18')],function(_0x597a88){if(_0x597a88){logger['error'](_0x597a88);return _0x315657['status'](0x1f4)['json'](_0x597a88);}logger[_0xa607('0x19')](_0xa607('0x1a'));return _0x315657['status'](0xc8)[_0xa607('0x11')]({'output':'git\x20reset\x20--hard'});});};exports[_0xa607('0x1b')]=function(_0x595fbf,_0x1ac238){exec(_0xa607('0x1c'),function(_0x124a1b,_0x24a0be,_0x179afb){logger[_0xa607('0x19')](_0x24a0be);logger[_0xa607('0x19')](_0x179afb);if(_0x124a1b){logger['error'](_0x124a1b);return _0x1ac238[_0xa607('0x10')](0x1f4)[_0xa607('0x11')](_0x124a1b);}return _0x1ac238[_0xa607('0x10')](0xc8)['json']({'output':_0x24a0be});});};exports[_0xa607('0x1d')]=function(_0x37fc3c,_0x3df999){return pm2[_0xa607('0x1d')](_0xa607('0x1e'))[_0xa607('0x1f')](function(_0x149b4b){logger[_0xa607('0x19')](_0xa607('0x20'),_0x149b4b);return _0x3df999[_0xa607('0x10')](0xc8)['json']({'output':_0xa607('0x21')});})[_0xa607('0x22')](function(_0x60d6da){logger[_0xa607('0x13')](_0x60d6da);return _0x3df999[_0xa607('0x10')](0x1f4)['json'](_0x60d6da);});};exports[_0xa607('0x23')]=function(_0x58953e,_0x4d305e){var _0x531eeb=fs['readdirSync'](path[_0xa607('0x24')](config[_0xa607('0x9')],'server','migrations'));var _0x1e3ddc=[];for(var _0x3881f1=0x0;_0x3881f1<_0x531eeb[_0xa607('0x25')];_0x3881f1++){var _0x205bfa=_0x531eeb[_0x3881f1][_0xa607('0x26')](_0xa607('0x27'),'');if(compareVersions(module[_0xa607('0xa')][_0xa607('0x28')],_0x205bfa)===-0x1){_0x1e3ddc[_0xa607('0x29')](_0x205bfa);}}if(_0x1e3ddc[_0xa607('0x25')]){var _0x2277ee=_0x1e3ddc[_0xa607('0x2a')](compareVersions);var _0x78dcfb=new Umzug({'storage':_0xa607('0x2b'),'storageOptions':{'model':db[_0xa607('0x2c')],'modelName':'Migration','columnName':_0xa607('0x28')},'migrations':{'params':[db[_0xa607('0x2b')][_0xa607('0x2d')](),db[_0xa607('0x2b')][_0xa607('0x2e')],function(){throw new Error(_0xa607('0x2f'));}],'path':path[_0xa607('0x24')](config[_0xa607('0x9')],_0xa607('0x30'),_0xa607('0x23')),'pattern':/\.js$/}});_0x78dcfb['up']({'migrations':_[_0xa607('0x31')](_0x2277ee,function(_0xac146b){return _0xac146b+_0xa607('0x27');})})[_0xa607('0x1f')](function(){return _0x4d305e['status'](0xc8)[_0xa607('0x11')]({'output':_0xa607('0x32')+module[_0xa607('0xa')][_0xa607('0x28')]+_0xa607('0x33')+_[_0xa607('0x34')](_0x2277ee),'migrations':_[_0xa607('0x24')](_0x2277ee)});})[_0xa607('0x22')](function(_0x349d20){if(_0x349d20 instanceof db['sequelize']['UniqueConstraintError']){return _0x4d305e[_0xa607('0x10')](0xc8)[_0xa607('0x11')]({'output':_0xa607('0x35')});}else{return _0x4d305e['status'](0x1f4)[_0xa607('0x11')](_0x349d20);}});}else{return _0x4d305e['status'](0xc8)[_0xa607('0x11')]({'output':_0xa607('0x35')});}};
\ No newline at end of file
+var _0xf1c5=['--hard','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','server','length','replace','sequelize','Migration','constructor','join','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','pkginfo','version','child_process','exec','../../config/environment','../../config/pm2','../../config/logger','root','index','exports','query','latest','2.0.0','status','json','fetch','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset'];(function(_0x4a7e2d,_0x5840a4){var _0x3dd463=function(_0x2978ab){while(--_0x2978ab){_0x4a7e2d['push'](_0x4a7e2d['shift']());}};_0x3dd463(++_0x5840a4);}(_0xf1c5,0x1db));var _0x5f1c=function(_0x3c1a29,_0x35fb6d){_0x3c1a29=_0x3c1a29-0x0;var _0x2cbb47=_0xf1c5[_0x3c1a29];return _0x2cbb47;};'use strict';var Umzug=require(_0x5f1c('0x0'));var path=require(_0x5f1c('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x5f1c('0x2'))(module,_0x5f1c('0x3'));var compareVersions=require('compare-versions');var exec=require(_0x5f1c('0x4'))[_0x5f1c('0x5')];var db=require('../../mysqldb')['db'];var config=require(_0x5f1c('0x6'));var pm2=require(_0x5f1c('0x7'));var logger=require(_0x5f1c('0x8'))('update');var git=require('simple-git')(config[_0x5f1c('0x9')]);exports[_0x5f1c('0xa')]=function(_0x2c7c00,_0x18aa28){var _0x56c77b={'current':module[_0x5f1c('0xb')][_0x5f1c('0x3')],'phonebar':0x2};if(_0x2c7c00[_0x5f1c('0xc')]&&_0x2c7c00[_0x5f1c('0xc')][_0x5f1c('0xd')]){return git['fetch']()['tags'](function(_0x4eb3e8,_0x5af8a9){_0x56c77b[_0x5f1c('0xd')]=(_0x4eb3e8?module[_0x5f1c('0xb')][_0x5f1c('0x3')]:_0x5af8a9[_0x5f1c('0xd')])||_0x5f1c('0xe');return _0x18aa28[_0x5f1c('0xf')](0xc8)[_0x5f1c('0x10')](_0x56c77b);});}else{return _0x18aa28['status'](0xc8)[_0x5f1c('0x10')](_0x56c77b);}};exports[_0x5f1c('0x11')]=function(_0x4e4e5c,_0x3b1e92){return git['fetch']([_0x5f1c('0x12'),_0x5f1c('0x13')],function(_0x45d76b){if(_0x45d76b){logger[_0x5f1c('0x14')](_0x45d76b);return _0x3b1e92[_0x5f1c('0xf')](0x1f4)[_0x5f1c('0x10')](_0x45d76b);}logger[_0x5f1c('0x15')](_0x5f1c('0x16'));return _0x3b1e92[_0x5f1c('0xf')](0xc8)[_0x5f1c('0x10')]({'output':_0x5f1c('0x17')});});};exports[_0x5f1c('0x18')]=function(_0x5b6198,_0x1ca9ef){return git[_0x5f1c('0x18')]([_0x5f1c('0x19'),'FETCH_HEAD'],function(_0x5d145f){if(_0x5d145f){logger[_0x5f1c('0x14')](_0x5d145f);return _0x1ca9ef[_0x5f1c('0xf')](0x1f4)['json'](_0x5d145f);}logger['info'](_0x5f1c('0x1a'));return _0x1ca9ef[_0x5f1c('0xf')](0xc8)['json']({'output':_0x5f1c('0x1b')});});};exports['pull']=function(_0x52c8c9,_0x415fd2){exec(_0x5f1c('0x1c'),function(_0x3657b7,_0x14327a,_0x17676d){logger[_0x5f1c('0x15')](_0x14327a);logger[_0x5f1c('0x15')](_0x17676d);if(_0x3657b7){logger[_0x5f1c('0x14')](_0x3657b7);return _0x415fd2[_0x5f1c('0xf')](0x1f4)['json'](_0x3657b7);}return _0x415fd2[_0x5f1c('0xf')](0xc8)[_0x5f1c('0x10')]({'output':_0x14327a});});};exports['restart']=function(_0x309cb7,_0x16bd65){return pm2[_0x5f1c('0x1d')](_0x5f1c('0x1e'))[_0x5f1c('0x1f')](function(_0x27484d){logger[_0x5f1c('0x15')](_0x5f1c('0x20'),_0x27484d);return _0x16bd65[_0x5f1c('0xf')](0xc8)[_0x5f1c('0x10')]({'output':_0x5f1c('0x21')});})[_0x5f1c('0x22')](function(_0x299845){logger[_0x5f1c('0x14')](_0x299845);return _0x16bd65['status'](0x1f4)[_0x5f1c('0x10')](_0x299845);});};exports[_0x5f1c('0x23')]=function(_0x35cfe2,_0x52b2d2){var _0x5e774f=fs[_0x5f1c('0x24')](path['join'](config[_0x5f1c('0x9')],_0x5f1c('0x25'),_0x5f1c('0x23')));var _0x4c015d=[];for(var _0x48c10a=0x0;_0x48c10a<_0x5e774f[_0x5f1c('0x26')];_0x48c10a++){var _0x2aae90=_0x5e774f[_0x48c10a][_0x5f1c('0x27')]('.js','');if(compareVersions(module['exports'][_0x5f1c('0x3')],_0x2aae90)===-0x1){_0x4c015d['push'](_0x2aae90);}}if(_0x4c015d['length']){var _0x309993=_0x4c015d['sort'](compareVersions);var _0x121670=new Umzug({'storage':_0x5f1c('0x28'),'storageOptions':{'model':db['Migration'],'modelName':_0x5f1c('0x29'),'columnName':_0x5f1c('0x3')},'migrations':{'params':[db[_0x5f1c('0x28')]['getQueryInterface'](),db[_0x5f1c('0x28')][_0x5f1c('0x2a')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path[_0x5f1c('0x2b')](config[_0x5f1c('0x9')],_0x5f1c('0x25'),_0x5f1c('0x23')),'pattern':/\.js$/}});_0x121670['up']({'migrations':_['map'](_0x309993,function(_0x262f24){return _0x262f24+_0x5f1c('0x2c');})})['then'](function(){return _0x52b2d2[_0x5f1c('0xf')](0xc8)['json']({'output':_0x5f1c('0x2d')+module[_0x5f1c('0xb')]['version']+_0x5f1c('0x2e')+_[_0x5f1c('0x2f')](_0x309993),'migrations':_['join'](_0x309993)});})[_0x5f1c('0x22')](function(_0xad10f3){if(_0xad10f3 instanceof db[_0x5f1c('0x28')][_0x5f1c('0x30')]){return _0x52b2d2['status'](0xc8)[_0x5f1c('0x10')]({'output':_0x5f1c('0x31')});}else{return _0x52b2d2[_0x5f1c('0xf')](0x1f4)[_0x5f1c('0x10')](_0xad10f3);}});}else{return _0x52b2d2[_0x5f1c('0xf')](0xc8)[_0x5f1c('0x10')]({'output':_0x5f1c('0x31')});}};
\ No newline at end of file