Built motion from commit 1fa89557.|2.6.10
[motion2.git] / server / api / license / license.controller.js
index 43b0e2a..bd21742 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa049=['fields','length','merge','options','getLicense','catch','body','find','params','get','checkLicense','key','demo','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','stack','name','send','model','keys','License','rawAttributes','query','filters','intersection','attributes'];(function(_0x38db6c,_0x2faf6e){var _0x583a1c=function(_0x1a2551){while(--_0x1a2551){_0x38db6c['push'](_0x38db6c['shift']());}};_0x583a1c(++_0x2faf6e);}(_0xa049,0x1db));var _0x9a04=function(_0x5249be,_0x251784){_0x5249be=_0x5249be-0x0;var _0x19ba8e=_0xa049[_0x5249be];return _0x19ba8e;};'use strict';var pdf=require(_0x9a04('0x0'));var emlformat=require(_0x9a04('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9a04('0x2'));var jsonpatch=require(_0x9a04('0x3'));var rp=require(_0x9a04('0x4'));var moment=require(_0x9a04('0x5'));var BPromise=require(_0x9a04('0x6'));var Mustache=require(_0x9a04('0x7'));var util=require(_0x9a04('0x8'));var path=require(_0x9a04('0x9'));var sox=require(_0x9a04('0xa'));var csv=require('to-csv');var ejs=require(_0x9a04('0xb'));var fs=require('fs');var _=require(_0x9a04('0xc'));var squel=require('squel');var crypto=require(_0x9a04('0xd'));var jsforce=require(_0x9a04('0xe'));var deskjs=require(_0x9a04('0xf'));var toCsv=require(_0x9a04('0x10'));var querystring=require(_0x9a04('0x11'));var Papa=require(_0x9a04('0x12'));var Redis=require('ioredis');var authService=require(_0x9a04('0x13'));var qs=require(_0x9a04('0x14'));var as=require(_0x9a04('0x15'));var hardwareService=require(_0x9a04('0x16'));var logger=require(_0x9a04('0x17'))(_0x9a04('0x18'));var utils=require('../../config/utils');var config=require(_0x9a04('0x19'));var licenseUtil=require(_0x9a04('0x1a'));var db=require(_0x9a04('0x1b'))['db'];function respondWithStatusCode(_0x554fd7,_0x2fbfe9){_0x2fbfe9=_0x2fbfe9||0xcc;return function(_0x279d98){if(_0x279d98){return _0x554fd7[_0x9a04('0x1c')](_0x2fbfe9);}return _0x554fd7[_0x9a04('0x1d')](_0x2fbfe9)[_0x9a04('0x1e')]();};}function respondWithResult(_0x551d17,_0x453104){_0x453104=_0x453104||0xc8;return function(_0x49a642){if(_0x49a642){return _0x551d17[_0x9a04('0x1d')](_0x453104)[_0x9a04('0x1f')](_0x49a642);}};}function respondWithFilteredResult(_0x5f2e4a,_0xd5159){return function(_0x12b723){if(_0x12b723){var _0x549aeb=_0x12b723[_0x9a04('0x20')],_0x8637bb=_0xd5159[_0x9a04('0x21')],_0x3dda79=_0xd5159['offset']+_0xd5159[_0x9a04('0x22')],_0x17f482;if(_0x3dda79>=_0x549aeb){_0x3dda79=_0x549aeb;_0x17f482=0xc8;}else{_0x17f482=0xce;}_0x5f2e4a[_0x9a04('0x1d')](_0x17f482);return _0x5f2e4a[_0x9a04('0x23')](_0x9a04('0x24'),_0x8637bb+'-'+_0x3dda79+'/'+_0x549aeb)[_0x9a04('0x1f')](_0x12b723);}return null;};}function patchUpdates(_0x7d83d7){return function(_0xb7c3d6){try{jsonpatch['apply'](_0xb7c3d6,_0x7d83d7,!![]);}catch(_0x4e4141){return BPromise[_0x9a04('0x25')](_0x4e4141);}return _0xb7c3d6[_0x9a04('0x26')]();};}function saveUpdates(_0x5b61fc,_0x1cc722){return function(_0x8ff643){if(_0x8ff643){return _0x8ff643[_0x9a04('0x27')](_0x5b61fc)[_0x9a04('0x28')](function(_0x22fd4a){return _0x22fd4a;});}return null;};}function removeEntity(_0x321741,_0x46d635){return function(_0x4c5116){if(_0x4c5116){return _0x4c5116[_0x9a04('0x29')]()[_0x9a04('0x28')](function(){_0x321741['status'](0xcc)[_0x9a04('0x1e')]();});}};}function handleEntityNotFound(_0xdbeafd,_0x38c515){return function(_0x4a949c){if(!_0x4a949c){_0xdbeafd[_0x9a04('0x1c')](0x194);}return _0x4a949c;};}function handleError(_0x4a81f2,_0xab89a){_0xab89a=_0xab89a||0x1f4;return function(_0x9b3de7){logger['error'](_0x9b3de7[_0x9a04('0x2a')]);if(_0x9b3de7[_0x9a04('0x2b')]){delete _0x9b3de7[_0x9a04('0x2b')];}_0x4a81f2[_0x9a04('0x1d')](_0xab89a)[_0x9a04('0x2c')](_0x9b3de7);};}var utilLicense=require(_0x9a04('0x1a'));exports['index']=function(_0x5879ee,_0xb724a9){var _0x363136={'raw':!![],'where':{'id':0x1}},_0xb3bb0a={};_0xb3bb0a[_0x9a04('0x2d')]=_[_0x9a04('0x2e')](db[_0x9a04('0x2f')][_0x9a04('0x30')]);_0xb3bb0a[_0x9a04('0x31')]=_[_0x9a04('0x2e')](_0x5879ee['query']);_0xb3bb0a[_0x9a04('0x32')]=_[_0x9a04('0x33')](_0xb3bb0a[_0x9a04('0x2d')],_0xb3bb0a[_0x9a04('0x31')]);_0x363136[_0x9a04('0x34')]=_[_0x9a04('0x33')](_0xb3bb0a[_0x9a04('0x2d')],qs[_0x9a04('0x35')](_0x5879ee[_0x9a04('0x31')][_0x9a04('0x35')]));_0x363136[_0x9a04('0x34')]=_0x363136[_0x9a04('0x34')][_0x9a04('0x36')]?_0x363136[_0x9a04('0x34')]:_0xb3bb0a[_0x9a04('0x2d')];_0x363136=_[_0x9a04('0x37')]({},_0x363136,_0x5879ee[_0x9a04('0x38')]);return utilLicense[_0x9a04('0x39')](_0x363136)[_0x9a04('0x28')](respondWithResult(_0xb724a9,null))[_0x9a04('0x3a')](handleError(_0xb724a9,null));};exports[_0x9a04('0x27')]=function(_0x2a0c0b,_0x4a70ef){if(_0x2a0c0b[_0x9a04('0x3b')]['id']){delete _0x2a0c0b[_0x9a04('0x3b')]['id'];}return db[_0x9a04('0x2f')][_0x9a04('0x3c')]({'where':{'id':_0x2a0c0b[_0x9a04('0x3d')]['id']}})['then'](handleEntityNotFound(_0x4a70ef,null))['then'](function(_0x5d0170){var _0x431d75=_0x5d0170[_0x9a04('0x3e')]({'plain':!![]});return utilLicense[_0x9a04('0x3f')](_0x431d75,_0x2a0c0b[_0x9a04('0x3b')][_0x9a04('0x40')]);})[_0x9a04('0x28')](function(_0x31f417){if(!_0x31f417[_0x9a04('0x41')]){return saveUpdates(_0x2a0c0b[_0x9a04('0x3b')],null);}return _0x31f417;})[_0x9a04('0x28')](respondWithResult(_0x4a70ef,null))[_0x9a04('0x3a')](handleError(_0x4a70ef,null));};
\ No newline at end of file
+var _0x19e5=['then','error','name','send','index','model','keys','License','rawAttributes','query','intersection','fields','attributes','length','getLicense','update','body','find','params','get','demo','downloadLogFile','license-info.log','/var','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','set','Content-Type','text/plain','download','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','reject','save','destroy'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x19e5,0x65));var _0x519e=function(_0x3f333c,_0x14f59a){_0x3f333c=_0x3f333c-0x0;var _0x6af3ad=_0x19e5[_0x3f333c];return _0x6af3ad;};'use strict';var emlformat=require(_0x519e('0x0'));var rimraf=require(_0x519e('0x1'));var zipdir=require(_0x519e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x519e('0x3'));var moment=require(_0x519e('0x4'));var BPromise=require(_0x519e('0x5'));var Mustache=require(_0x519e('0x6'));var util=require(_0x519e('0x7'));var path=require(_0x519e('0x8'));var sox=require(_0x519e('0x9'));var csv=require(_0x519e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x519e('0xb'));var _=require(_0x519e('0xc'));var squel=require(_0x519e('0xd'));var crypto=require(_0x519e('0xe'));var jsforce=require(_0x519e('0xf'));var deskjs=require(_0x519e('0x10'));var toCsv=require(_0x519e('0xa'));var querystring=require('querystring');var Papa=require(_0x519e('0x11'));var Redis=require(_0x519e('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x519e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x519e('0x14'));var logger=require(_0x519e('0x15'))(_0x519e('0x16'));var utils=require(_0x519e('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x519e('0x18'));var db=require(_0x519e('0x19'))['db'];function respondWithStatusCode(_0x17492d,_0x1fcbb8){_0x1fcbb8=_0x1fcbb8||0xcc;return function(_0x143a9b){if(_0x143a9b){return _0x17492d[_0x519e('0x1a')](_0x1fcbb8);}return _0x17492d[_0x519e('0x1b')](_0x1fcbb8)[_0x519e('0x1c')]();};}function respondWithResult(_0x253c33,_0x23d56b){_0x23d56b=_0x23d56b||0xc8;return function(_0x39e240){if(_0x39e240){return _0x253c33[_0x519e('0x1b')](_0x23d56b)['json'](_0x39e240);}};}function respondWithFilteredResult(_0x5e4774,_0x1fb19c){return function(_0x524c10){if(_0x524c10){var _0x49810b=typeof _0x1fb19c[_0x519e('0x1d')]==='undefined'&&typeof _0x1fb19c['limit']===_0x519e('0x1e');var _0x2b7534=_0x524c10[_0x519e('0x1f')];var _0x33a956=_0x49810b?0x0:_0x1fb19c[_0x519e('0x1d')];var _0x3627cb=_0x49810b?_0x524c10[_0x519e('0x1f')]:_0x1fb19c[_0x519e('0x1d')]+_0x1fb19c['limit'];var _0x55cd27;if(_0x3627cb>=_0x2b7534){_0x3627cb=_0x2b7534;_0x55cd27=0xc8;}else{_0x55cd27=0xce;}_0x5e4774['status'](_0x55cd27);return _0x5e4774['set']('Content-Range',_0x33a956+'-'+_0x3627cb+'/'+_0x2b7534)['json'](_0x524c10);}return null;};}function patchUpdates(_0x7f97fb){return function(_0x4ebdbc){try{jsonpatch['apply'](_0x4ebdbc,_0x7f97fb,!![]);}catch(_0x163397){return BPromise[_0x519e('0x20')](_0x163397);}return _0x4ebdbc[_0x519e('0x21')]();};}function saveUpdates(_0x130419,_0x3b12c8){return function(_0x33fdab){if(_0x33fdab){return _0x33fdab['update'](_0x130419)['then'](function(_0x43e7a0){return _0x43e7a0;});}return null;};}function removeEntity(_0x38a8aa,_0x36524c){return function(_0x2deb3b){if(_0x2deb3b){return _0x2deb3b[_0x519e('0x22')]()[_0x519e('0x23')](function(){_0x38a8aa[_0x519e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5061b4,_0x2ea7c4){return function(_0xaf43d8){if(!_0xaf43d8){_0x5061b4[_0x519e('0x1a')](0x194);}return _0xaf43d8;};}function handleError(_0x164b83,_0x151bcb){_0x151bcb=_0x151bcb||0x1f4;return function(_0x541c8){logger[_0x519e('0x24')](_0x541c8['stack']);if(_0x541c8[_0x519e('0x25')]){delete _0x541c8['name'];}_0x164b83[_0x519e('0x1b')](_0x151bcb)[_0x519e('0x26')](_0x541c8);};}var utilLicense=require(_0x519e('0x18'));exports[_0x519e('0x27')]=function(_0x438bd2,_0x1d8e6a){var _0x4f0daf={'raw':!![],'where':{'id':0x1}},_0xa6e21c={};_0xa6e21c[_0x519e('0x28')]=_[_0x519e('0x29')](db[_0x519e('0x2a')][_0x519e('0x2b')]);_0xa6e21c[_0x519e('0x2c')]=_[_0x519e('0x29')](_0x438bd2[_0x519e('0x2c')]);_0xa6e21c['filters']=_[_0x519e('0x2d')](_0xa6e21c[_0x519e('0x28')],_0xa6e21c['query']);_0x4f0daf['attributes']=_[_0x519e('0x2d')](_0xa6e21c[_0x519e('0x28')],qs[_0x519e('0x2e')](_0x438bd2[_0x519e('0x2c')][_0x519e('0x2e')]));_0x4f0daf[_0x519e('0x2f')]=_0x4f0daf['attributes'][_0x519e('0x30')]?_0x4f0daf[_0x519e('0x2f')]:_0xa6e21c[_0x519e('0x28')];_0x4f0daf=_['merge']({},_0x4f0daf,_0x438bd2['options']);return utilLicense[_0x519e('0x31')](_0x4f0daf)[_0x519e('0x23')](respondWithResult(_0x1d8e6a,null))['catch'](handleError(_0x1d8e6a,null));};exports[_0x519e('0x32')]=function(_0x5b0716,_0x502595){if(_0x5b0716[_0x519e('0x33')]['id']){delete _0x5b0716['body']['id'];}return db['License'][_0x519e('0x34')]({'where':{'id':_0x5b0716[_0x519e('0x35')]['id']}})['then'](handleEntityNotFound(_0x502595,null))[_0x519e('0x23')](function(_0x549681){var _0x22573b=_0x549681[_0x519e('0x36')]({'plain':!![]});return utilLicense['checkLicense'](_0x22573b,_0x5b0716[_0x519e('0x33')]['key']);})['then'](function(_0x32ccbf){if(!_0x32ccbf[_0x519e('0x37')]){return saveUpdates(_0x5b0716['body'],null);}return _0x32ccbf;})[_0x519e('0x23')](respondWithResult(_0x502595,null))['catch'](handleError(_0x502595,null));};exports[_0x519e('0x38')]=function(_0xed0c5f,_0x54430d){var _0x569b92=_0x519e('0x39');var _0x1a47cf=path['join'](_0x519e('0x3a'),_0x519e('0x3b'),_0x519e('0x3c'),_0x569b92);_0x54430d[_0x519e('0x3d')](_0x519e('0x3e'),_0x519e('0x3f')+_0x569b92);_0x54430d[_0x519e('0x40')](_0x519e('0x41'),_0x519e('0x42'));_0x54430d[_0x519e('0x43')](_0x1a47cf);};
\ No newline at end of file