Built motion from commit 2b9af5da.|2.6.26
[motion2.git] / server / api / license / license.controller.js
index 454a9ab..d9f12e9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x60de=['jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','model','keys','License','query','filters','intersection','fields','attributes','length','getLicense','catch','body','find','params','downloadLogFile','join','/var','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto'];(function(_0x574a9b,_0x273af4){var _0x297fae=function(_0x5aa9f8){while(--_0x5aa9f8){_0x574a9b['push'](_0x574a9b['shift']());}};_0x297fae(++_0x273af4);}(_0x60de,0x77));var _0xe60d=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x60de[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require(_0xe60d('0x0'));var rimraf=require(_0xe60d('0x1'));var zipdir=require(_0xe60d('0x2'));var jsonpatch=require(_0xe60d('0x3'));var rp=require('request-promise');var moment=require(_0xe60d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe60d('0x5'));var util=require(_0xe60d('0x6'));var path=require(_0xe60d('0x7'));var sox=require(_0xe60d('0x8'));var csv=require(_0xe60d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe60d('0xa'));var squel=require(_0xe60d('0xb'));var crypto=require(_0xe60d('0xc'));var jsforce=require(_0xe60d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe60d('0x9'));var querystring=require(_0xe60d('0xe'));var Papa=require(_0xe60d('0xf'));var Redis=require('ioredis');var authService=require(_0xe60d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe60d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe60d('0x12'));var utils=require(_0xe60d('0x13'));var config=require(_0xe60d('0x14'));var licenseUtil=require(_0xe60d('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4bd649,_0x450e4e){_0x450e4e=_0x450e4e||0xcc;return function(_0x4203e4){if(_0x4203e4){return _0x4bd649[_0xe60d('0x16')](_0x450e4e);}return _0x4bd649[_0xe60d('0x17')](_0x450e4e)[_0xe60d('0x18')]();};}function respondWithResult(_0x52c6d7,_0x3337d9){_0x3337d9=_0x3337d9||0xc8;return function(_0x35685f){if(_0x35685f){return _0x52c6d7[_0xe60d('0x17')](_0x3337d9)[_0xe60d('0x19')](_0x35685f);}};}function respondWithFilteredResult(_0x205e59,_0x305ea8){return function(_0x3107ad){if(_0x3107ad){var _0x1c6d4b=typeof _0x305ea8[_0xe60d('0x1a')]===_0xe60d('0x1b')&&typeof _0x305ea8[_0xe60d('0x1c')]==='undefined';var _0x525227=_0x3107ad[_0xe60d('0x1d')];var _0x27c83b=_0x1c6d4b?0x0:_0x305ea8['offset'];var _0x1a0b16=_0x1c6d4b?_0x3107ad[_0xe60d('0x1d')]:_0x305ea8[_0xe60d('0x1a')]+_0x305ea8['limit'];var _0x5b4ff8;if(_0x1a0b16>=_0x525227){_0x1a0b16=_0x525227;_0x5b4ff8=0xc8;}else{_0x5b4ff8=0xce;}_0x205e59[_0xe60d('0x17')](_0x5b4ff8);return _0x205e59[_0xe60d('0x1e')](_0xe60d('0x1f'),_0x27c83b+'-'+_0x1a0b16+'/'+_0x525227)[_0xe60d('0x19')](_0x3107ad);}return null;};}function patchUpdates(_0x375057){return function(_0x4a90e8){try{jsonpatch[_0xe60d('0x20')](_0x4a90e8,_0x375057,!![]);}catch(_0x1b9b86){return BPromise[_0xe60d('0x21')](_0x1b9b86);}return _0x4a90e8['save']();};}function saveUpdates(_0x399725,_0x420bf9){return function(_0xe379df){if(_0xe379df){return _0xe379df[_0xe60d('0x22')](_0x399725)[_0xe60d('0x23')](function(_0x5e1847){return _0x5e1847;});}return null;};}function removeEntity(_0x26d5a1,_0x59361a){return function(_0x7222e3){if(_0x7222e3){return _0x7222e3['destroy']()[_0xe60d('0x23')](function(){_0x26d5a1[_0xe60d('0x17')](0xcc)[_0xe60d('0x18')]();});}};}function handleEntityNotFound(_0x4d581a,_0xf68b42){return function(_0x567a5a){if(!_0x567a5a){_0x4d581a[_0xe60d('0x16')](0x194);}return _0x567a5a;};}function handleError(_0x55008a,_0x54e6e5){_0x54e6e5=_0x54e6e5||0x1f4;return function(_0x47ee85){logger[_0xe60d('0x24')](_0x47ee85[_0xe60d('0x25')]);if(_0x47ee85[_0xe60d('0x26')]){delete _0x47ee85['name'];}_0x55008a['status'](_0x54e6e5)[_0xe60d('0x27')](_0x47ee85);};}var utilLicense=require(_0xe60d('0x15'));exports[_0xe60d('0x28')]=function(_0x2d7d85,_0x3d8c3e){var _0x420534={'raw':!![],'where':{'id':0x1}},_0x2b020d={};_0x2b020d[_0xe60d('0x29')]=_[_0xe60d('0x2a')](db[_0xe60d('0x2b')]['rawAttributes']);_0x2b020d[_0xe60d('0x2c')]=_[_0xe60d('0x2a')](_0x2d7d85[_0xe60d('0x2c')]);_0x2b020d[_0xe60d('0x2d')]=_[_0xe60d('0x2e')](_0x2b020d[_0xe60d('0x29')],_0x2b020d[_0xe60d('0x2c')]);_0x420534['attributes']=_[_0xe60d('0x2e')](_0x2b020d['model'],qs[_0xe60d('0x2f')](_0x2d7d85['query'][_0xe60d('0x2f')]));_0x420534[_0xe60d('0x30')]=_0x420534['attributes'][_0xe60d('0x31')]?_0x420534['attributes']:_0x2b020d[_0xe60d('0x29')];_0x420534=_['merge']({},_0x420534,_0x2d7d85['options']);return utilLicense[_0xe60d('0x32')](_0x420534)[_0xe60d('0x23')](respondWithResult(_0x3d8c3e,null))[_0xe60d('0x33')](handleError(_0x3d8c3e,null));};exports[_0xe60d('0x22')]=function(_0x39888b,_0x5a2208){if(_0x39888b[_0xe60d('0x34')]['id']){delete _0x39888b[_0xe60d('0x34')]['id'];}return db[_0xe60d('0x2b')][_0xe60d('0x35')]({'where':{'id':_0x39888b[_0xe60d('0x36')]['id']}})[_0xe60d('0x23')](handleEntityNotFound(_0x5a2208,null))[_0xe60d('0x23')](function(_0x4a8acc){var _0x12eb89=_0x4a8acc['get']({'plain':!![]});return utilLicense['checkLicense'](_0x12eb89,_0x39888b[_0xe60d('0x34')]['key']);})[_0xe60d('0x23')](function(_0x236320){if(!_0x236320['demo']){return saveUpdates(_0x39888b[_0xe60d('0x34')],null);}return _0x236320;})[_0xe60d('0x23')](respondWithResult(_0x5a2208,null))[_0xe60d('0x33')](handleError(_0x5a2208,null));};exports[_0xe60d('0x37')]=function(_0x4016b2,_0x6a21dd){var _0x2a2973='license-info.log';var _0x2c4c07=path[_0xe60d('0x38')](_0xe60d('0x39'),_0xe60d('0x3a'),_0xe60d('0x3b'),_0x2a2973);_0x6a21dd[_0xe60d('0x3c')](_0xe60d('0x3d'),_0xe60d('0x3e')+_0x2a2973);_0x6a21dd['set'](_0xe60d('0x3f'),_0xe60d('0x40'));_0x6a21dd[_0xe60d('0x41')](_0x2c4c07);};
\ No newline at end of file
+var _0xdc40=['attachment;\x20filename=','Content-Type','text/plain','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','apply','reject','update','then','destroy','name','model','License','rawAttributes','query','intersection','fields','attributes','length','catch','body','find','key','demo','license-info.log','/var','log','setHeader'];(function(_0x406414,_0x27e918){var _0x132e6c=function(_0x3bbde5){while(--_0x3bbde5){_0x406414['push'](_0x406414['shift']());}};_0x132e6c(++_0x27e918);}(_0xdc40,0xa8));var _0x0dc4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xdc40[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x0dc4('0x0'));var rimraf=require(_0x0dc4('0x1'));var zipdir=require(_0x0dc4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0dc4('0x3'));var BPromise=require(_0x0dc4('0x4'));var Mustache=require(_0x0dc4('0x5'));var util=require('util');var path=require(_0x0dc4('0x6'));var sox=require(_0x0dc4('0x7'));var csv=require(_0x0dc4('0x8'));var ejs=require(_0x0dc4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0dc4('0xa'));var squel=require(_0x0dc4('0xb'));var crypto=require('crypto');var jsforce=require(_0x0dc4('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0dc4('0x8'));var querystring=require(_0x0dc4('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0dc4('0xe'));var qs=require(_0x0dc4('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0dc4('0x10'));var logger=require(_0x0dc4('0x11'))('api');var utils=require(_0x0dc4('0x12'));var config=require(_0x0dc4('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x0dc4('0x14'))['db'];function respondWithStatusCode(_0x1a144c,_0x51998c){_0x51998c=_0x51998c||0xcc;return function(_0x38e666){if(_0x38e666){return _0x1a144c[_0x0dc4('0x15')](_0x51998c);}return _0x1a144c[_0x0dc4('0x16')](_0x51998c)[_0x0dc4('0x17')]();};}function respondWithResult(_0xac3f5b,_0x58feb1){_0x58feb1=_0x58feb1||0xc8;return function(_0x89733f){if(_0x89733f){return _0xac3f5b[_0x0dc4('0x16')](_0x58feb1)[_0x0dc4('0x18')](_0x89733f);}};}function respondWithFilteredResult(_0x379921,_0x6979e2){return function(_0x55400e){if(_0x55400e){var _0x47b02f=typeof _0x6979e2[_0x0dc4('0x19')]==='undefined'&&typeof _0x6979e2[_0x0dc4('0x1a')]==='undefined';var _0x193a04=_0x55400e[_0x0dc4('0x1b')];var _0x537bd2=_0x47b02f?0x0:_0x6979e2[_0x0dc4('0x19')];var _0x2642d1=_0x47b02f?_0x55400e[_0x0dc4('0x1b')]:_0x6979e2[_0x0dc4('0x19')]+_0x6979e2['limit'];var _0x646a85;if(_0x2642d1>=_0x193a04){_0x2642d1=_0x193a04;_0x646a85=0xc8;}else{_0x646a85=0xce;}_0x379921[_0x0dc4('0x16')](_0x646a85);return _0x379921[_0x0dc4('0x1c')]('Content-Range',_0x537bd2+'-'+_0x2642d1+'/'+_0x193a04)[_0x0dc4('0x18')](_0x55400e);}return null;};}function patchUpdates(_0x4b7248){return function(_0x1faf2a){try{jsonpatch[_0x0dc4('0x1d')](_0x1faf2a,_0x4b7248,!![]);}catch(_0x42da04){return BPromise[_0x0dc4('0x1e')](_0x42da04);}return _0x1faf2a['save']();};}function saveUpdates(_0x2c6f71,_0x405411){return function(_0x4fd2c8){if(_0x4fd2c8){return _0x4fd2c8[_0x0dc4('0x1f')](_0x2c6f71)[_0x0dc4('0x20')](function(_0x3a2f12){return _0x3a2f12;});}return null;};}function removeEntity(_0x494b6e,_0xa6438e){return function(_0x13e1f8){if(_0x13e1f8){return _0x13e1f8[_0x0dc4('0x21')]()[_0x0dc4('0x20')](function(){_0x494b6e[_0x0dc4('0x16')](0xcc)[_0x0dc4('0x17')]();});}};}function handleEntityNotFound(_0x5cfee0,_0x105b73){return function(_0x53a4dd){if(!_0x53a4dd){_0x5cfee0['sendStatus'](0x194);}return _0x53a4dd;};}function handleError(_0x20e4a0,_0x38bd0f){_0x38bd0f=_0x38bd0f||0x1f4;return function(_0x43ba2b){logger['error'](_0x43ba2b['stack']);if(_0x43ba2b[_0x0dc4('0x22')]){delete _0x43ba2b[_0x0dc4('0x22')];}_0x20e4a0[_0x0dc4('0x16')](_0x38bd0f)['send'](_0x43ba2b);};}var utilLicense=require('../../config/license/util');exports['index']=function(_0xdc3f02,_0x55f347){var _0x119ea5={'raw':!![],'where':{'id':0x1}},_0x3d690a={};_0x3d690a[_0x0dc4('0x23')]=_['keys'](db[_0x0dc4('0x24')][_0x0dc4('0x25')]);_0x3d690a[_0x0dc4('0x26')]=_['keys'](_0xdc3f02[_0x0dc4('0x26')]);_0x3d690a['filters']=_[_0x0dc4('0x27')](_0x3d690a[_0x0dc4('0x23')],_0x3d690a[_0x0dc4('0x26')]);_0x119ea5['attributes']=_[_0x0dc4('0x27')](_0x3d690a[_0x0dc4('0x23')],qs[_0x0dc4('0x28')](_0xdc3f02[_0x0dc4('0x26')][_0x0dc4('0x28')]));_0x119ea5[_0x0dc4('0x29')]=_0x119ea5[_0x0dc4('0x29')][_0x0dc4('0x2a')]?_0x119ea5['attributes']:_0x3d690a[_0x0dc4('0x23')];_0x119ea5=_['merge']({},_0x119ea5,_0xdc3f02['options']);return utilLicense['getLicense'](_0x119ea5)[_0x0dc4('0x20')](respondWithResult(_0x55f347,null))[_0x0dc4('0x2b')](handleError(_0x55f347,null));};exports['update']=function(_0x56df45,_0x4caf38){if(_0x56df45[_0x0dc4('0x2c')]['id']){delete _0x56df45[_0x0dc4('0x2c')]['id'];}return db[_0x0dc4('0x24')][_0x0dc4('0x2d')]({'where':{'id':_0x56df45['params']['id']}})[_0x0dc4('0x20')](handleEntityNotFound(_0x4caf38,null))['then'](function(_0x130c59){var _0x4896f8=_0x130c59['get']({'plain':!![]});return utilLicense['checkLicense'](_0x4896f8,_0x56df45[_0x0dc4('0x2c')][_0x0dc4('0x2e')]);})[_0x0dc4('0x20')](function(_0x2c0eda){if(!_0x2c0eda[_0x0dc4('0x2f')]){return saveUpdates(_0x56df45[_0x0dc4('0x2c')],null);}return _0x2c0eda;})['then'](respondWithResult(_0x4caf38,null))[_0x0dc4('0x2b')](handleError(_0x4caf38,null));};exports['downloadLogFile']=function(_0x533371,_0x38adc6){var _0x55e0d3=_0x0dc4('0x30');var _0x244f80=path['join'](_0x0dc4('0x31'),_0x0dc4('0x32'),'xcally',_0x55e0d3);_0x38adc6[_0x0dc4('0x33')]('Content-disposition',_0x0dc4('0x34')+_0x55e0d3);_0x38adc6[_0x0dc4('0x1c')](_0x0dc4('0x35'),_0x0dc4('0x36'));_0x38adc6['download'](_0x244f80);};
\ No newline at end of file