Built motion from commit (unavailable).|2.5.15
[motion2.git] / server / components / license / service.js
index a2ae7d1..75d984d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf6c8=['parse','hasOwnProperty','findOne','then','count','status','json','catch','admin','user','isUserLimit','util','composable-middleware','../../mysqldb','data1','license','split','createDecipher','aes-256-ctr','format','base64','utf8'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf6c8,0x16b));var _0x8f6c=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xf6c8[_0x1b349a];return _0x5d1f7c;};'use strict';var crypto=require('crypto');var util=require(_0x8f6c('0x0'));var compose=require(_0x8f6c('0x1'));var db=require(_0x8f6c('0x2'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x5f3326,_0x600f15){if(_0x5f3326&&_0x600f15){if(_0x600f15[_0x8f6c('0x3')]&&_0x600f15[_0x8f6c('0x4')]){var _0x11ccf2=_0x600f15[_0x8f6c('0x3')];var _0x2779b3=_0x600f15[_0x8f6c('0x4')];var _0x5b03af=_0x11ccf2[_0x8f6c('0x5')]('-')[0x4];var _0x35eb7b=_0x11ccf2['split']('-')[0x0];var _0x36f38c=crypto[_0x8f6c('0x6')](_0x8f6c('0x7'),util[_0x8f6c('0x8')]('%s:%s:%s',_0x5b03af,_0x11ccf2,_0x35eb7b));var _0x150d0f=_0x36f38c['update'](_0x2779b3,_0x8f6c('0x9'),_0x8f6c('0xa'));_0x150d0f+=_0x36f38c['final'](_0x8f6c('0xa'));var _0x53c037=JSON[_0x8f6c('0xb')](_0x150d0f);return _0x53c037[_0x8f6c('0xc')](_0x5f3326)?_0x53c037[_0x5f3326]:null;}}return null;}function isLimit(_0x2d1cec,_0x198ec4,_0x5648ff,_0x146e1a){var _0x542bb2=_0x198ec4;return compose()['use'](function(_0x1b049a,_0x5ed4a1,_0x212896){return db['License'][_0x8f6c('0xd')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x59ee82){var _0xdfc5d3=getValueFromLicense(_0x2d1cec,_0x59ee82);return _0xdfc5d3?_0xdfc5d3:_0x542bb2;})[_0x8f6c('0xe')](function(_0x48edf9){_0x542bb2=_0x48edf9;return _0x5648ff[_0x8f6c('0xf')](_0x146e1a);})[_0x8f6c('0xe')](function(_0x1b3466){if(_0x1b3466>=_0x542bb2){return _0x5ed4a1[_0x8f6c('0x10')](0x193)[_0x8f6c('0x11')]({'message':util[_0x8f6c('0x8')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x2d1cec)});}_0x212896();})[_0x8f6c('0x12')](function(_0x3cbc63){_0x212896(_0x3cbc63);});});}function isUserLimit(){return isLimit('users',0x1,db['User'],{'where':{'$or':[{'role':_0x8f6c('0x13')},{'role':_0x8f6c('0x14')}]}});}exports[_0x8f6c('0x15')]=isUserLimit;
\ No newline at end of file
+var _0x76e7=['final','hasOwnProperty','use','License','findOne','then','count','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','User','user','crypto','composable-middleware','../../mysqldb','data1','license','split','createDecipher','format','update','base64','utf8'];(function(_0x41ade7,_0x21627f){var _0x248d77=function(_0x755c7e){while(--_0x755c7e){_0x41ade7['push'](_0x41ade7['shift']());}};_0x248d77(++_0x21627f);}(_0x76e7,0xbb));var _0x776e=function(_0x510c1b,_0x178e2d){_0x510c1b=_0x510c1b-0x0;var _0x183aa9=_0x76e7[_0x510c1b];return _0x183aa9;};'use strict';var crypto=require(_0x776e('0x0'));var util=require('util');var compose=require(_0x776e('0x1'));var db=require(_0x776e('0x2'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x5abe35,_0x4b13fd){if(_0x5abe35&&_0x4b13fd){if(_0x4b13fd[_0x776e('0x3')]&&_0x4b13fd[_0x776e('0x4')]){var _0x469958=_0x4b13fd[_0x776e('0x3')];var _0x4265e6=_0x4b13fd['license'];var _0xac7b4f=_0x469958[_0x776e('0x5')]('-')[0x4];var _0x399b69=_0x469958[_0x776e('0x5')]('-')[0x0];var _0x2a48d7=crypto[_0x776e('0x6')]('aes-256-ctr',util[_0x776e('0x7')]('%s:%s:%s',_0xac7b4f,_0x469958,_0x399b69));var _0x3f8190=_0x2a48d7[_0x776e('0x8')](_0x4265e6,_0x776e('0x9'),_0x776e('0xa'));_0x3f8190+=_0x2a48d7[_0x776e('0xb')](_0x776e('0xa'));var _0x5e1760=JSON['parse'](_0x3f8190);return _0x5e1760[_0x776e('0xc')](_0x5abe35)?_0x5e1760[_0x5abe35]:null;}}return null;}function isLimit(_0x3d15e0,_0x367aaa,_0x13a82a,_0x38c5ae){var _0x1623fe=_0x367aaa;return compose()[_0x776e('0xd')](function(_0x25dbba,_0x2dcbf5,_0x550692){return db[_0x776e('0xe')][_0x776e('0xf')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x24d670){var _0x692654=getValueFromLicense(_0x3d15e0,_0x24d670);return _0x692654?_0x692654:_0x1623fe;})[_0x776e('0x10')](function(_0x29998b){_0x1623fe=_0x29998b;return _0x13a82a[_0x776e('0x11')](_0x38c5ae);})['then'](function(_0x11933b){if(_0x11933b>=_0x1623fe){return _0x2dcbf5['status'](0x193)[_0x776e('0x12')]({'message':util['format'](_0x776e('0x13'),_0x3d15e0)});}_0x550692();})['catch'](function(_0x4489ae){_0x550692(_0x4489ae);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x776e('0x14')],{'where':{'$or':[{'role':'admin'},{'role':_0x776e('0x15')}]}});}exports['isUserLimit']=isUserLimit;
\ No newline at end of file