Built motion from commit 092f8824.|2.5.49
[motion2.git] / server / api / license / license.controller.js
index cbb676b..f94f1d6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcb41=['query','attributes','intersection','model','fields','length','merge','options','getLicense','catch','body','find','get','checkLicense','key','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','apply','save','update','then','error','stack','name','index','keys','License','rawAttributes'];(function(_0x16760c,_0x2d0884){var _0x51c968=function(_0x567583){while(--_0x567583){_0x16760c['push'](_0x16760c['shift']());}};_0x51c968(++_0x2d0884);}(_0xcb41,0x1df));var _0x1cb4=function(_0x11a5ac,_0x4d1c0c){_0x11a5ac=_0x11a5ac-0x0;var _0x45d4a4=_0xcb41[_0x11a5ac];return _0x45d4a4;};'use strict';var pdf=require(_0x1cb4('0x0'));var emlformat=require(_0x1cb4('0x1'));var rimraf=require(_0x1cb4('0x2'));var zipdir=require(_0x1cb4('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1cb4('0x4'));var moment=require('moment');var BPromise=require(_0x1cb4('0x5'));var Mustache=require(_0x1cb4('0x6'));var util=require(_0x1cb4('0x7'));var path=require(_0x1cb4('0x8'));var sox=require(_0x1cb4('0x9'));var csv=require(_0x1cb4('0xa'));var ejs=require(_0x1cb4('0xb'));var fs=require('fs');var _=require(_0x1cb4('0xc'));var squel=require('squel');var crypto=require(_0x1cb4('0xd'));var jsforce=require(_0x1cb4('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1cb4('0xa'));var querystring=require(_0x1cb4('0xf'));var Papa=require(_0x1cb4('0x10'));var Redis=require('ioredis');var authService=require(_0x1cb4('0x11'));var qs=require(_0x1cb4('0x12'));var as=require(_0x1cb4('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1cb4('0x14'));var utils=require('../../config/utils');var config=require(_0x1cb4('0x15'));var licenseUtil=require(_0x1cb4('0x16'));var db=require(_0x1cb4('0x17'))['db'];function respondWithStatusCode(_0xd57cb1,_0x2409a2){_0x2409a2=_0x2409a2||0xcc;return function(_0x4eafc0){if(_0x4eafc0){return _0xd57cb1[_0x1cb4('0x18')](_0x2409a2);}return _0xd57cb1['status'](_0x2409a2)[_0x1cb4('0x19')]();};}function respondWithResult(_0x3d2f2e,_0x29a3bf){_0x29a3bf=_0x29a3bf||0xc8;return function(_0xb01aec){if(_0xb01aec){return _0x3d2f2e[_0x1cb4('0x1a')](_0x29a3bf)[_0x1cb4('0x1b')](_0xb01aec);}};}function respondWithFilteredResult(_0x34e04e,_0x35783e){return function(_0xc444d){if(_0xc444d){var _0x1858f1=_0xc444d[_0x1cb4('0x1c')],_0x521b49=_0x35783e[_0x1cb4('0x1d')],_0xbc72fd=_0x35783e['offset']+_0x35783e['limit'],_0x514285;if(_0xbc72fd>=_0x1858f1){_0xbc72fd=_0x1858f1;_0x514285=0xc8;}else{_0x514285=0xce;}_0x34e04e[_0x1cb4('0x1a')](_0x514285);return _0x34e04e[_0x1cb4('0x1e')](_0x1cb4('0x1f'),_0x521b49+'-'+_0xbc72fd+'/'+_0x1858f1)[_0x1cb4('0x1b')](_0xc444d);}return null;};}function patchUpdates(_0x274f12){return function(_0x43e481){try{jsonpatch[_0x1cb4('0x20')](_0x43e481,_0x274f12,!![]);}catch(_0xdbb325){return BPromise['reject'](_0xdbb325);}return _0x43e481[_0x1cb4('0x21')]();};}function saveUpdates(_0x1d1a19,_0x5a24ec){return function(_0x33993b){if(_0x33993b){return _0x33993b[_0x1cb4('0x22')](_0x1d1a19)[_0x1cb4('0x23')](function(_0x19d342){return _0x19d342;});}return null;};}function removeEntity(_0x4e5f9b,_0x316325){return function(_0x51fc8d){if(_0x51fc8d){return _0x51fc8d['destroy']()[_0x1cb4('0x23')](function(){_0x4e5f9b[_0x1cb4('0x1a')](0xcc)[_0x1cb4('0x19')]();});}};}function handleEntityNotFound(_0x4d93b9,_0x3533e8){return function(_0x33ec9c){if(!_0x33ec9c){_0x4d93b9[_0x1cb4('0x18')](0x194);}return _0x33ec9c;};}function handleError(_0x5bce36,_0x70d3dc){_0x70d3dc=_0x70d3dc||0x1f4;return function(_0x1e8d9c){logger[_0x1cb4('0x24')](_0x1e8d9c[_0x1cb4('0x25')]);if(_0x1e8d9c['name']){delete _0x1e8d9c[_0x1cb4('0x26')];}_0x5bce36['status'](_0x70d3dc)['send'](_0x1e8d9c);};}var utilLicense=require('../../config/license/util');exports[_0x1cb4('0x27')]=function(_0x54b46f,_0x28ac89){var _0x17f4e1={'raw':!![],'where':{'id':0x1}},_0x569fff={};_0x569fff['model']=_[_0x1cb4('0x28')](db[_0x1cb4('0x29')][_0x1cb4('0x2a')]);_0x569fff[_0x1cb4('0x2b')]=_[_0x1cb4('0x28')](_0x54b46f[_0x1cb4('0x2b')]);_0x569fff['filters']=_['intersection'](_0x569fff['model'],_0x569fff[_0x1cb4('0x2b')]);_0x17f4e1[_0x1cb4('0x2c')]=_[_0x1cb4('0x2d')](_0x569fff[_0x1cb4('0x2e')],qs[_0x1cb4('0x2f')](_0x54b46f[_0x1cb4('0x2b')][_0x1cb4('0x2f')]));_0x17f4e1[_0x1cb4('0x2c')]=_0x17f4e1[_0x1cb4('0x2c')][_0x1cb4('0x30')]?_0x17f4e1[_0x1cb4('0x2c')]:_0x569fff[_0x1cb4('0x2e')];_0x17f4e1=_[_0x1cb4('0x31')]({},_0x17f4e1,_0x54b46f[_0x1cb4('0x32')]);return utilLicense[_0x1cb4('0x33')](_0x17f4e1)[_0x1cb4('0x23')](respondWithResult(_0x28ac89,null))[_0x1cb4('0x34')](handleError(_0x28ac89,null));};exports[_0x1cb4('0x22')]=function(_0x527875,_0x2722a2){if(_0x527875[_0x1cb4('0x35')]['id']){delete _0x527875[_0x1cb4('0x35')]['id'];}return db[_0x1cb4('0x29')][_0x1cb4('0x36')]({'where':{'id':_0x527875['params']['id']}})[_0x1cb4('0x23')](handleEntityNotFound(_0x2722a2,null))[_0x1cb4('0x23')](function(_0x5aa5e4){var _0x375a26=_0x5aa5e4[_0x1cb4('0x37')]({'plain':!![]});return utilLicense[_0x1cb4('0x38')](_0x375a26,_0x527875[_0x1cb4('0x35')][_0x1cb4('0x39')]);})[_0x1cb4('0x23')](function(_0x525af6){if(!_0x525af6['demo']){return saveUpdates(_0x527875[_0x1cb4('0x35')],null);}return _0x525af6;})['then'](respondWithResult(_0x2722a2,null))['catch'](handleError(_0x2722a2,null));};
\ No newline at end of file
+var _0x5327=['attachment;\x20filename=','text/plain','download','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack','name','send','index','model','License','rawAttributes','query','filters','attributes','intersection','fields','length','merge','options','getLicense','catch','body','params','get','checkLicense','key','demo','downloadLogFile','license-info.log','join','/var','log','xcally','setHeader','Content-disposition'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5327,0x1ad));var _0x7532=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5327[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x7532('0x0'));var rimraf=require(_0x7532('0x1'));var zipdir=require(_0x7532('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7532('0x3'));var moment=require('moment');var BPromise=require(_0x7532('0x4'));var Mustache=require(_0x7532('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x7532('0x6'));var ejs=require(_0x7532('0x7'));var fs=require('fs');var fs_extra=require(_0x7532('0x8'));var _=require(_0x7532('0x9'));var squel=require(_0x7532('0xa'));var crypto=require(_0x7532('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7532('0xc'));var toCsv=require(_0x7532('0x6'));var querystring=require(_0x7532('0xd'));var Papa=require(_0x7532('0xe'));var Redis=require(_0x7532('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7532('0x10'));var hardwareService=require(_0x7532('0x11'));var logger=require(_0x7532('0x12'))(_0x7532('0x13'));var utils=require(_0x7532('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x7532('0x15'));var db=require(_0x7532('0x16'))['db'];function respondWithStatusCode(_0x1d6e11,_0x4c21d9){_0x4c21d9=_0x4c21d9||0xcc;return function(_0x1b377d){if(_0x1b377d){return _0x1d6e11[_0x7532('0x17')](_0x4c21d9);}return _0x1d6e11[_0x7532('0x18')](_0x4c21d9)[_0x7532('0x19')]();};}function respondWithResult(_0x2a32f1,_0x5110a0){_0x5110a0=_0x5110a0||0xc8;return function(_0x254ee3){if(_0x254ee3){return _0x2a32f1[_0x7532('0x18')](_0x5110a0)[_0x7532('0x1a')](_0x254ee3);}};}function respondWithFilteredResult(_0x19a2cf,_0x264b93){return function(_0x503eb1){if(_0x503eb1){var _0x5095eb=typeof _0x264b93[_0x7532('0x1b')]===_0x7532('0x1c')&&typeof _0x264b93[_0x7532('0x1d')]===_0x7532('0x1c');var _0x362873=_0x503eb1[_0x7532('0x1e')];var _0xd037e0=_0x5095eb?0x0:_0x264b93[_0x7532('0x1b')];var _0x5bbe7e=_0x5095eb?_0x503eb1[_0x7532('0x1e')]:_0x264b93[_0x7532('0x1b')]+_0x264b93[_0x7532('0x1d')];var _0x12a910;if(_0x5bbe7e>=_0x362873){_0x5bbe7e=_0x362873;_0x12a910=0xc8;}else{_0x12a910=0xce;}_0x19a2cf[_0x7532('0x18')](_0x12a910);return _0x19a2cf[_0x7532('0x1f')](_0x7532('0x20'),_0xd037e0+'-'+_0x5bbe7e+'/'+_0x362873)['json'](_0x503eb1);}return null;};}function patchUpdates(_0x87337b){return function(_0x3ac4c1){try{jsonpatch['apply'](_0x3ac4c1,_0x87337b,!![]);}catch(_0x360476){return BPromise['reject'](_0x360476);}return _0x3ac4c1['save']();};}function saveUpdates(_0x43b4d4,_0xf0b7fb){return function(_0x5074bd){if(_0x5074bd){return _0x5074bd[_0x7532('0x21')](_0x43b4d4)[_0x7532('0x22')](function(_0x5ed6ba){return _0x5ed6ba;});}return null;};}function removeEntity(_0x49de4c,_0x4da4ab){return function(_0x483dda){if(_0x483dda){return _0x483dda[_0x7532('0x23')]()['then'](function(){_0x49de4c[_0x7532('0x18')](0xcc)[_0x7532('0x19')]();});}};}function handleEntityNotFound(_0xa3e05d,_0x3f3d46){return function(_0x3c25c2){if(!_0x3c25c2){_0xa3e05d[_0x7532('0x17')](0x194);}return _0x3c25c2;};}function handleError(_0x559e88,_0x6fa0a4){_0x6fa0a4=_0x6fa0a4||0x1f4;return function(_0x35f2db){logger[_0x7532('0x24')](_0x35f2db[_0x7532('0x25')]);if(_0x35f2db['name']){delete _0x35f2db[_0x7532('0x26')];}_0x559e88[_0x7532('0x18')](_0x6fa0a4)[_0x7532('0x27')](_0x35f2db);};}var utilLicense=require(_0x7532('0x15'));exports[_0x7532('0x28')]=function(_0x17eb7b,_0x4c74f4){var _0xfb7408={'raw':!![],'where':{'id':0x1}},_0x4f575d={};_0x4f575d[_0x7532('0x29')]=_['keys'](db[_0x7532('0x2a')][_0x7532('0x2b')]);_0x4f575d[_0x7532('0x2c')]=_['keys'](_0x17eb7b[_0x7532('0x2c')]);_0x4f575d[_0x7532('0x2d')]=_['intersection'](_0x4f575d[_0x7532('0x29')],_0x4f575d[_0x7532('0x2c')]);_0xfb7408[_0x7532('0x2e')]=_[_0x7532('0x2f')](_0x4f575d[_0x7532('0x29')],qs[_0x7532('0x30')](_0x17eb7b['query']['fields']));_0xfb7408[_0x7532('0x2e')]=_0xfb7408['attributes'][_0x7532('0x31')]?_0xfb7408[_0x7532('0x2e')]:_0x4f575d['model'];_0xfb7408=_[_0x7532('0x32')]({},_0xfb7408,_0x17eb7b[_0x7532('0x33')]);return utilLicense[_0x7532('0x34')](_0xfb7408)['then'](respondWithResult(_0x4c74f4,null))[_0x7532('0x35')](handleError(_0x4c74f4,null));};exports[_0x7532('0x21')]=function(_0x27065d,_0x30f8c1){if(_0x27065d[_0x7532('0x36')]['id']){delete _0x27065d[_0x7532('0x36')]['id'];}return db[_0x7532('0x2a')]['find']({'where':{'id':_0x27065d[_0x7532('0x37')]['id']}})[_0x7532('0x22')](handleEntityNotFound(_0x30f8c1,null))[_0x7532('0x22')](function(_0x26728d){var _0x51c776=_0x26728d[_0x7532('0x38')]({'plain':!![]});return utilLicense[_0x7532('0x39')](_0x51c776,_0x27065d[_0x7532('0x36')][_0x7532('0x3a')]);})['then'](function(_0x2ff598){if(!_0x2ff598[_0x7532('0x3b')]){return saveUpdates(_0x27065d[_0x7532('0x36')],null);}return _0x2ff598;})[_0x7532('0x22')](respondWithResult(_0x30f8c1,null))[_0x7532('0x35')](handleError(_0x30f8c1,null));};exports[_0x7532('0x3c')]=function(_0x21187f,_0xb88f98){var _0x26aa32=_0x7532('0x3d');var _0x43f6a5=path[_0x7532('0x3e')](_0x7532('0x3f'),_0x7532('0x40'),_0x7532('0x41'),_0x26aa32);_0xb88f98[_0x7532('0x42')](_0x7532('0x43'),_0x7532('0x44')+_0x26aa32);_0xb88f98[_0x7532('0x1f')]('Content-Type',_0x7532('0x45'));_0xb88f98[_0x7532('0x46')](_0x43f6a5);};
\ No newline at end of file