Built motion from commit 85328c08.|2.5.50
[motion2.git] / server / api / license / license.controller.js
index dfd19c7..f1b89be 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x326f=['sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','stack','name','send','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','options','getLicense','catch','body','License','find','checkLicense','key','demo','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x326f,0xd1));var _0xf326=function(_0x3da3f4,_0xca7e70){_0x3da3f4=_0x3da3f4-0x0;var _0x2384fd=_0x326f[_0x3da3f4];return _0x2384fd;};'use strict';var emlformat=require(_0xf326('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf326('0x1'));var rp=require(_0xf326('0x2'));var moment=require(_0xf326('0x3'));var BPromise=require(_0xf326('0x4'));var Mustache=require(_0xf326('0x5'));var util=require(_0xf326('0x6'));var path=require(_0xf326('0x7'));var sox=require(_0xf326('0x8'));var csv=require(_0xf326('0x9'));var ejs=require(_0xf326('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf326('0xb'));var squel=require(_0xf326('0xc'));var crypto=require(_0xf326('0xd'));var jsforce=require(_0xf326('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf326('0xf'));var Redis=require(_0xf326('0x10'));var authService=require(_0xf326('0x11'));var qs=require(_0xf326('0x12'));var as=require(_0xf326('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf326('0x14'))('api');var utils=require(_0xf326('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf326('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3162f9,_0x9ed463){_0x9ed463=_0x9ed463||0xcc;return function(_0x4b3966){if(_0x4b3966){return _0x3162f9[_0xf326('0x17')](_0x9ed463);}return _0x3162f9[_0xf326('0x18')](_0x9ed463)[_0xf326('0x19')]();};}function respondWithResult(_0x17a098,_0x5c8483){_0x5c8483=_0x5c8483||0xc8;return function(_0x45c1b6){if(_0x45c1b6){return _0x17a098['status'](_0x5c8483)['json'](_0x45c1b6);}};}function respondWithFilteredResult(_0xdf21d9,_0x11f6d2){return function(_0x1f2e5a){if(_0x1f2e5a){var _0xa63d1a=typeof _0x11f6d2[_0xf326('0x1a')]===_0xf326('0x1b')&&typeof _0x11f6d2[_0xf326('0x1c')]===_0xf326('0x1b');var _0x5a682a=_0x1f2e5a[_0xf326('0x1d')];var _0x453100=_0xa63d1a?0x0:_0x11f6d2[_0xf326('0x1a')];var _0x31ffb9=_0xa63d1a?_0x1f2e5a[_0xf326('0x1d')]:_0x11f6d2[_0xf326('0x1a')]+_0x11f6d2['limit'];var _0x4a5b6c;if(_0x31ffb9>=_0x5a682a){_0x31ffb9=_0x5a682a;_0x4a5b6c=0xc8;}else{_0x4a5b6c=0xce;}_0xdf21d9['status'](_0x4a5b6c);return _0xdf21d9[_0xf326('0x1e')](_0xf326('0x1f'),_0x453100+'-'+_0x31ffb9+'/'+_0x5a682a)['json'](_0x1f2e5a);}return null;};}function patchUpdates(_0x4cabce){return function(_0x128c68){try{jsonpatch['apply'](_0x128c68,_0x4cabce,!![]);}catch(_0x5b6d3c){return BPromise[_0xf326('0x20')](_0x5b6d3c);}return _0x128c68[_0xf326('0x21')]();};}function saveUpdates(_0x549b46,_0x5aa184){return function(_0x19b8ba){if(_0x19b8ba){return _0x19b8ba[_0xf326('0x22')](_0x549b46)['then'](function(_0x337ed5){return _0x337ed5;});}return null;};}function removeEntity(_0x1b9039,_0x43c53e){return function(_0x295752){if(_0x295752){return _0x295752[_0xf326('0x23')]()[_0xf326('0x24')](function(){_0x1b9039['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f31f6,_0x520d85){return function(_0x1a2c4e){if(!_0x1a2c4e){_0x4f31f6[_0xf326('0x17')](0x194);}return _0x1a2c4e;};}function handleError(_0x1ff2b5,_0x148953){_0x148953=_0x148953||0x1f4;return function(_0x410237){logger['error'](_0x410237[_0xf326('0x25')]);if(_0x410237[_0xf326('0x26')]){delete _0x410237[_0xf326('0x26')];}_0x1ff2b5['status'](_0x148953)[_0xf326('0x27')](_0x410237);};}var utilLicense=require('../../config/license/util');exports['index']=function(_0x6a8e89,_0x1ae23a){var _0x2fa28e={'raw':!![],'where':{'id':0x1}},_0x5dbe63={};_0x5dbe63[_0xf326('0x28')]=_[_0xf326('0x29')](db['License'][_0xf326('0x2a')]);_0x5dbe63[_0xf326('0x2b')]=_[_0xf326('0x29')](_0x6a8e89[_0xf326('0x2b')]);_0x5dbe63[_0xf326('0x2c')]=_[_0xf326('0x2d')](_0x5dbe63[_0xf326('0x28')],_0x5dbe63[_0xf326('0x2b')]);_0x2fa28e[_0xf326('0x2e')]=_[_0xf326('0x2d')](_0x5dbe63['model'],qs[_0xf326('0x2f')](_0x6a8e89[_0xf326('0x2b')][_0xf326('0x2f')]));_0x2fa28e['attributes']=_0x2fa28e[_0xf326('0x2e')][_0xf326('0x30')]?_0x2fa28e[_0xf326('0x2e')]:_0x5dbe63['model'];_0x2fa28e=_['merge']({},_0x2fa28e,_0x6a8e89[_0xf326('0x31')]);return utilLicense[_0xf326('0x32')](_0x2fa28e)[_0xf326('0x24')](respondWithResult(_0x1ae23a,null))[_0xf326('0x33')](handleError(_0x1ae23a,null));};exports[_0xf326('0x22')]=function(_0x2e8a64,_0x62585a){if(_0x2e8a64[_0xf326('0x34')]['id']){delete _0x2e8a64['body']['id'];}return db[_0xf326('0x35')][_0xf326('0x36')]({'where':{'id':_0x2e8a64['params']['id']}})[_0xf326('0x24')](handleEntityNotFound(_0x62585a,null))['then'](function(_0xce1cbb){var _0x481b64=_0xce1cbb['get']({'plain':!![]});return utilLicense[_0xf326('0x37')](_0x481b64,_0x2e8a64['body'][_0xf326('0x38')]);})['then'](function(_0x310dbb){if(!_0x310dbb[_0xf326('0x39')]){return saveUpdates(_0x2e8a64[_0xf326('0x34')],null);}return _0x310dbb;})['then'](respondWithResult(_0x62585a,null))[_0xf326('0x33')](handleError(_0x62585a,null));};
\ No newline at end of file
+var _0x68bd=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save','update','then','destroy','name','send','index','model','keys','License','rawAttributes','query','filters','intersection','attributes','fields','length','merge','options','getLicense','catch','body','find','get','checkLicense','license-info.log','join','/var','Content-disposition','Content-Type','text/plain','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring'];(function(_0x3b7b8a,_0x52c3b0){var _0x441206=function(_0x5d34d3){while(--_0x5d34d3){_0x3b7b8a['push'](_0x3b7b8a['shift']());}};_0x441206(++_0x52c3b0);}(_0x68bd,0x182));var _0xd68b=function(_0x25390b,_0x1771ca){_0x25390b=_0x25390b-0x0;var _0x490180=_0x68bd[_0x25390b];return _0x490180;};'use strict';var emlformat=require(_0xd68b('0x0'));var rimraf=require(_0xd68b('0x1'));var zipdir=require(_0xd68b('0x2'));var jsonpatch=require(_0xd68b('0x3'));var rp=require(_0xd68b('0x4'));var moment=require('moment');var BPromise=require(_0xd68b('0x5'));var Mustache=require(_0xd68b('0x6'));var util=require('util');var path=require(_0xd68b('0x7'));var sox=require(_0xd68b('0x8'));var csv=require(_0xd68b('0x9'));var ejs=require(_0xd68b('0xa'));var fs=require('fs');var fs_extra=require(_0xd68b('0xb'));var _=require(_0xd68b('0xc'));var squel=require(_0xd68b('0xd'));var crypto=require('crypto');var jsforce=require(_0xd68b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd68b('0x9'));var querystring=require(_0xd68b('0xf'));var Papa=require('papaparse');var Redis=require(_0xd68b('0x10'));var authService=require(_0xd68b('0x11'));var qs=require(_0xd68b('0x12'));var as=require(_0xd68b('0x13'));var hardwareService=require(_0xd68b('0x14'));var logger=require(_0xd68b('0x15'))('api');var utils=require(_0xd68b('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd68b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c804a,_0x38b8f3){_0x38b8f3=_0x38b8f3||0xcc;return function(_0x2ac7d6){if(_0x2ac7d6){return _0x5c804a[_0xd68b('0x18')](_0x38b8f3);}return _0x5c804a['status'](_0x38b8f3)[_0xd68b('0x19')]();};}function respondWithResult(_0x40d684,_0x796d6){_0x796d6=_0x796d6||0xc8;return function(_0x33ab53){if(_0x33ab53){return _0x40d684['status'](_0x796d6)[_0xd68b('0x1a')](_0x33ab53);}};}function respondWithFilteredResult(_0x7a4e3a,_0x3652c6){return function(_0xaf6faa){if(_0xaf6faa){var _0x392422=typeof _0x3652c6[_0xd68b('0x1b')]===_0xd68b('0x1c')&&typeof _0x3652c6[_0xd68b('0x1d')]==='undefined';var _0x453904=_0xaf6faa[_0xd68b('0x1e')];var _0xd94580=_0x392422?0x0:_0x3652c6[_0xd68b('0x1b')];var _0x8e2a14=_0x392422?_0xaf6faa[_0xd68b('0x1e')]:_0x3652c6['offset']+_0x3652c6[_0xd68b('0x1d')];var _0x7add2;if(_0x8e2a14>=_0x453904){_0x8e2a14=_0x453904;_0x7add2=0xc8;}else{_0x7add2=0xce;}_0x7a4e3a[_0xd68b('0x1f')](_0x7add2);return _0x7a4e3a[_0xd68b('0x20')](_0xd68b('0x21'),_0xd94580+'-'+_0x8e2a14+'/'+_0x453904)['json'](_0xaf6faa);}return null;};}function patchUpdates(_0x154d95){return function(_0x86d1a){try{jsonpatch[_0xd68b('0x22')](_0x86d1a,_0x154d95,!![]);}catch(_0x57e285){return BPromise['reject'](_0x57e285);}return _0x86d1a[_0xd68b('0x23')]();};}function saveUpdates(_0xceba03,_0x21442b){return function(_0x466382){if(_0x466382){return _0x466382[_0xd68b('0x24')](_0xceba03)[_0xd68b('0x25')](function(_0x5de3a6){return _0x5de3a6;});}return null;};}function removeEntity(_0x169e06,_0xf0d810){return function(_0x3b0f2a){if(_0x3b0f2a){return _0x3b0f2a[_0xd68b('0x26')]()[_0xd68b('0x25')](function(){_0x169e06[_0xd68b('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4357d0,_0x2f8dbd){return function(_0x1c62eb){if(!_0x1c62eb){_0x4357d0['sendStatus'](0x194);}return _0x1c62eb;};}function handleError(_0x3f6adf,_0x121ac0){_0x121ac0=_0x121ac0||0x1f4;return function(_0x127eda){logger['error'](_0x127eda['stack']);if(_0x127eda[_0xd68b('0x27')]){delete _0x127eda[_0xd68b('0x27')];}_0x3f6adf[_0xd68b('0x1f')](_0x121ac0)[_0xd68b('0x28')](_0x127eda);};}var utilLicense=require('../../config/license/util');exports[_0xd68b('0x29')]=function(_0xd971f7,_0x20e373){var _0x135f03={'raw':!![],'where':{'id':0x1}},_0x32de24={};_0x32de24[_0xd68b('0x2a')]=_[_0xd68b('0x2b')](db[_0xd68b('0x2c')][_0xd68b('0x2d')]);_0x32de24[_0xd68b('0x2e')]=_[_0xd68b('0x2b')](_0xd971f7[_0xd68b('0x2e')]);_0x32de24[_0xd68b('0x2f')]=_[_0xd68b('0x30')](_0x32de24[_0xd68b('0x2a')],_0x32de24[_0xd68b('0x2e')]);_0x135f03[_0xd68b('0x31')]=_[_0xd68b('0x30')](_0x32de24['model'],qs[_0xd68b('0x32')](_0xd971f7[_0xd68b('0x2e')]['fields']));_0x135f03[_0xd68b('0x31')]=_0x135f03[_0xd68b('0x31')][_0xd68b('0x33')]?_0x135f03[_0xd68b('0x31')]:_0x32de24[_0xd68b('0x2a')];_0x135f03=_[_0xd68b('0x34')]({},_0x135f03,_0xd971f7[_0xd68b('0x35')]);return utilLicense[_0xd68b('0x36')](_0x135f03)[_0xd68b('0x25')](respondWithResult(_0x20e373,null))[_0xd68b('0x37')](handleError(_0x20e373,null));};exports[_0xd68b('0x24')]=function(_0x152886,_0x25f0f3){if(_0x152886[_0xd68b('0x38')]['id']){delete _0x152886['body']['id'];}return db[_0xd68b('0x2c')][_0xd68b('0x39')]({'where':{'id':_0x152886['params']['id']}})[_0xd68b('0x25')](handleEntityNotFound(_0x25f0f3,null))[_0xd68b('0x25')](function(_0x46f649){var _0x1d98e2=_0x46f649[_0xd68b('0x3a')]({'plain':!![]});return utilLicense[_0xd68b('0x3b')](_0x1d98e2,_0x152886['body']['key']);})[_0xd68b('0x25')](function(_0x58f04b){if(!_0x58f04b['demo']){return saveUpdates(_0x152886[_0xd68b('0x38')],null);}return _0x58f04b;})[_0xd68b('0x25')](respondWithResult(_0x25f0f3,null))[_0xd68b('0x37')](handleError(_0x25f0f3,null));};exports['downloadLogFile']=function(_0x38b204,_0x37d953){var _0x525cf3=_0xd68b('0x3c');var _0x1a4c20=path[_0xd68b('0x3d')](_0xd68b('0x3e'),'log','xcally',_0x525cf3);_0x37d953['setHeader'](_0xd68b('0x3f'),'attachment;\x20filename='+_0x525cf3);_0x37d953[_0xd68b('0x20')](_0xd68b('0x40'),_0xd68b('0x41'));_0x37d953[_0xd68b('0x42')](_0x1a4c20);};
\ No newline at end of file