Built motion from commit 5e31ea4.|0.0.32
[motion.git] / server / config / license / license.service.js
1 var _0x3f44=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x63\x6F\x6D\x70\x6F\x73\x61\x62\x6C\x65\x2D\x6D\x69\x64\x64\x6C\x65\x77\x61\x72\x65","\x6D\x6F\x6D\x65\x6E\x74","\x63\x72\x79\x70\x74\x6F","\x75\x74\x69\x6C","\x2E\x2E\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","","\x72\x65\x70\x6C\x61\x63\x65","\x6F\x75\x74\x70\x75\x74","\x64\x6D\x69\x64\x65\x63\x6F\x64\x65\x20\x2D\x2D\x73\x74\x72\x69\x6E\x67\x20\x73\x79\x73\x74\x65\x6D\x2D\x75\x75\x69\x64","\x2D","\x73\x70\x6C\x69\x74","\x55\x73\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x54\x65\x6C\x65\x70\x68\x6F\x6E\x65","\x53\x65\x74\x74\x69\x6E\x67\x73","\x44\x45\x4D\x4F\x20\x4C\x49\x43\x45\x4E\x53\x45","\x63\x61\x74\x63\x68","\x6C\x69\x63\x65\x6E\x73\x65","\x70\x61\x72\x73\x65","\x63\x68\x61\x74","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x73\x70\x72\x65\x61\x64","\x66\x69\x6E\x64\x4F\x72\x43\x72\x65\x61\x74\x65","\x75\x73\x65","\x6D\x61\x69\x6C","\x66\x61\x78","\x65\x78\x70\x69\x72\x61\x74\x69\x6F\x6E","\x69\x73\x53\x61\x6D\x65\x4F\x72\x42\x65\x66\x6F\x72\x65","\x75\x73\x65\x72\x73","\x4D\x61\x78\x69\x6D\x75\x6D\x20\x75\x73\x65\x72\x73\x20\x6C\x69\x6D\x69\x74\x20\x68\x61\x76\x65\x20\x62\x65\x65\x6E\x20\x72\x65\x61\x63\x68\x65\x64","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x61\x64\x6D\x69\x6E","\x75\x73\x65\x72","\x63\x6F\x75\x6E\x74","\x74\x65\x6C\x65\x70\x68\x6F\x6E\x65\x73","\x4D\x61\x78\x69\x6D\x75\x6D\x20\x74\x65\x6C\x65\x70\x68\x6F\x6E\x65\x73\x20\x6C\x69\x6D\x69\x74\x20\x68\x61\x76\x65\x20\x62\x65\x65\x6E\x20\x72\x65\x61\x63\x68\x65\x64","\x74\x65\x6C\x65\x70\x68\x6F\x6E\x65","\x72\x6F\x6C\x65","\x61\x67\x65\x6E\x74","\x6F\x6E\x6C\x69\x6E\x65","\x61\x67\x65\x6E\x74\x73","\x61\x65\x73\x2D\x32\x35\x36\x2D\x63\x74\x72","\x25\x73\x3A\x25\x73\x3A\x25\x73","\x66\x6F\x72\x6D\x61\x74","\x63\x72\x65\x61\x74\x65\x44\x65\x63\x69\x70\x68\x65\x72","\x62\x61\x73\x65\x36\x34","\x75\x74\x66\x38","\x75\x70\x64\x61\x74\x65","\x66\x69\x6E\x61\x6C","\x69\x73\x56\x61\x6C\x69\x64\x44\x61\x74\x65","\x69\x73\x55\x73\x65\x72\x73\x4C\x69\x6D\x69\x74","\x69\x73\x54\x65\x6C\x65\x70\x68\x6F\x6E\x65\x73\x4C\x69\x6D\x69\x74","\x68\x61\x73\x43\x68\x61\x74","\x68\x61\x73\x4D\x61\x69\x6C","\x68\x61\x73\x46\x61\x78","\x69\x73\x56\x61\x6C\x69\x64\x41\x67\x65\x6E\x74","\x64\x65\x6D\x6F\x4C\x69\x63\x65\x6E\x73\x65","\x64\x65\x63\x72\x79\x70\x74"];_0x3f44[0];var compose=require(_0x3f44[1]);var moment=require(_0x3f44[2]);var crypto=require(_0x3f44[3]);var util=require(_0x3f44[4]);var config=require(_0x3f44[5]);var uuid=exec(_0x3f44[9],{silent:true})[_0x3f44[8]][_0x3f44[7]](/\r?\n|\r/g,_0x3f44[6]);var prefix=uuid[_0x3f44[11]](_0x3f44[10])[4];var suffix=uuid[_0x3f44[11]](_0x3f44[10])[0];var User=require(_0x3f44[13])[_0x3f44[12]];var Telephone=require(_0x3f44[13])[_0x3f44[14]];var Settings=require(_0x3f44[13])[_0x3f44[15]];var demoLicense={users:1,agents:1,telephones:0,chat:false,mail:false,fax:false,description:_0x3f44[16]};function hasChat(){return compose()[_0x3f44[24]](function(_0x4edbxe,_0x4edbxf,_0x4edbx10){return Settings[_0x3f44[23]]({where:{id:1}})[_0x3f44[22]](function(_0x4edbx12){var _0x4edbx13=null,_0x4edbx14=false;if(_0x4edbx12[_0x3f44[18]]){_0x4edbx13=decrypt(_0x4edbx12[_0x3f44[18]]);_0x4edbx13=JSON[_0x3f44[19]](_0x4edbx13);}else {_0x4edbx13=demoLicense};_0x4edbx14=_0x4edbx13[_0x3f44[20]];if(!_0x4edbx14){return _0x4edbxf[_0x3f44[21]](403)};return _0x4edbx10();})[_0x3f44[17]](function(_0x4edbx11){return _0x4edbx10(_0x4edbx11)})})}function hasMail(){return compose()[_0x3f44[24]](function(_0x4edbxe,_0x4edbxf,_0x4edbx10){return Settings[_0x3f44[23]]({where:{id:1}})[_0x3f44[22]](function(_0x4edbx12){var _0x4edbx13=null,_0x4edbx16=false;if(_0x4edbx12[_0x3f44[18]]){_0x4edbx13=decrypt(_0x4edbx12[_0x3f44[18]]);_0x4edbx13=JSON[_0x3f44[19]](_0x4edbx13);}else {_0x4edbx13=demoLicense};_0x4edbx16=_0x4edbx13[_0x3f44[25]];if(!_0x4edbx16){return _0x4edbxf[_0x3f44[21]](403)};return _0x4edbx10();})[_0x3f44[17]](function(_0x4edbx11){return _0x4edbx10(_0x4edbx11)})})}function hasFax(){return compose()[_0x3f44[24]](function(_0x4edbxe,_0x4edbxf,_0x4edbx10){return Settings[_0x3f44[23]]({where:{id:1}})[_0x3f44[22]](function(_0x4edbx12){var _0x4edbx13=null,_0x4edbx18=false;if(_0x4edbx12[_0x3f44[18]]){_0x4edbx13=decrypt(_0x4edbx12[_0x3f44[18]]);_0x4edbx13=JSON[_0x3f44[19]](_0x4edbx13);}else {_0x4edbx13=demoLicense};_0x4edbx18=_0x4edbx13[_0x3f44[26]];if(!_0x4edbx18){return _0x4edbxf[_0x3f44[21]](403)};return _0x4edbx10();})[_0x3f44[17]](function(_0x4edbx11){return _0x4edbx10(_0x4edbx11)})})}function isValidDate(){return compose()[_0x3f44[24]](function(_0x4edbxe,_0x4edbxf,_0x4edbx10){return Settings[_0x3f44[23]]({where:{id:1}})[_0x3f44[22]](function(_0x4edbx12){var _0x4edbx13=null,_0x4edbx1a=false;if(_0x4edbx12[_0x3f44[18]]){_0x4edbx13=decrypt(_0x4edbx12[_0x3f44[18]]);_0x4edbx13=JSON[_0x3f44[19]](_0x4edbx13);if(moment()[_0x3f44[28]](_0x4edbx13[_0x3f44[27]])){_0x4edbx1a=true};};if(!_0x4edbx1a){return _0x4edbxf[_0x3f44[21]](403)};return _0x4edbx10();})[_0x3f44[17]](function(_0x4edbx11){return _0x4edbx10(_0x4edbx11)})})}function isUsersLimit(){return compose()[_0x3f44[24]](function(_0x4edbxe,_0x4edbxf,_0x4edbx10){var _0x4edbx1c;return Settings[_0x3f44[23]]({where:{id:1}})[_0x3f44[22]](function(_0x4edbx12){_0x4edbx1c=_0x4edbx12;return User[_0x3f44[36]]({where:{$or:[{role:_0x3f44[34]},{role:_0x3f44[35]}]}});})[_0x3f44[33]](function(_0x4edbx1d){var _0x4edbx13=null,_0x4edbx1e=false;if(_0x4edbx1c[_0x3f44[18]]){_0x4edbx13=decrypt(_0x4edbx1c[_0x3f44[18]]);_0x4edbx13=JSON[_0x3f44[19]](_0x4edbx13);}else {_0x4edbx13=demoLicense};if(_0x4edbx13[_0x3f44[29]]>_0x4edbx1d){_0x4edbx1e=true};if(!_0x4edbx1e){return _0x4edbxf[_0x3f44[32]](403)[_0x3f44[31]]({message:_0x3f44[30]})};return _0x4edbx10();})[_0x3f44[17]](function(_0x4edbx11){return _0x4edbx10(_0x4edbx11)});})}function isTelephonesLimit(){return compose()[_0x3f44[24]](function(_0x4edbxe,_0x4edbxf,_0x4edbx10){var _0x4edbx1c;return Settings[_0x3f44[23]]({where:{id:1}})[_0x3f44[22]](function(_0x4edbx12){_0x4edbx1c=_0x4edbx12;return User[_0x3f44[36]]({where:{role:_0x3f44[39]}});})[_0x3f44[33]](function(_0x4edbx20){var _0x4edbx13=null,_0x4edbx1e=false;if(_0x4edbx1c[_0x3f44[18]]){_0x4edbx13=decrypt(_0x4edbx1c[_0x3f44[18]]);_0x4edbx13=JSON[_0x3f44[19]](_0x4edbx13);}else {_0x4edbx13=demoLicense};if(_0x4edbx13[_0x3f44[37]]>_0x4edbx20){_0x4edbx1e=true};if(!_0x4edbx1e){return _0x4edbxf[_0x3f44[32]](403)[_0x3f44[31]]({message:_0x3f44[38]})};return _0x4edbx10();})[_0x3f44[17]](function(_0x4edbx11){return _0x4edbx10(_0x4edbx11)});})}function isValidAgent(){return function(_0x4edbx22){var _0x4edbx1c;var _0x4edbx23=false;if(_0x4edbx22[_0x3f44[40]]===_0x3f44[34]||_0x4edbx22[_0x3f44[40]]===_0x3f44[35]||(_0x4edbx22[_0x3f44[40]]===_0x3f44[41]&&_0x4edbx22[_0x3f44[42]])){_0x4edbx23=true};return Settings[_0x3f44[23]]({where:{id:1}})[_0x3f44[22]](function(_0x4edbx12){_0x4edbx1c=_0x4edbx12;return User[_0x3f44[36]]({where:{role:_0x3f44[41],online:true}});})[_0x3f44[33]](function(_0x4edbx24){var _0x4edbx13=null;if(_0x4edbx1c[_0x3f44[18]]){_0x4edbx13=decrypt(_0x4edbx1c[_0x3f44[18]]);_0x4edbx13=JSON[_0x3f44[19]](_0x4edbx13);}else {_0x4edbx13=demoLicense};if(_0x4edbx13[_0x3f44[43]]>_0x4edbx24){_0x4edbx23=true};return _0x4edbx23;});}}function decrypt(_0x4edbx26){var _0x4edbx27=crypto[_0x3f44[47]](_0x3f44[44],util[_0x3f44[46]](_0x3f44[45],prefix,uuid,suffix));var _0x4edbx13=_0x4edbx27[_0x3f44[50]](_0x4edbx26,_0x3f44[48],_0x3f44[49]);_0x4edbx13+=_0x4edbx27[_0x3f44[51]](_0x3f44[49]);return _0x4edbx13;}exports[_0x3f44[52]]=isValidDate;exports[_0x3f44[53]]=isUsersLimit;exports[_0x3f44[54]]=isTelephonesLimit;exports[_0x3f44[55]]=hasChat;exports[_0x3f44[56]]=hasMail;exports[_0x3f44[57]]=hasFax;exports[_0x3f44[58]]=isValidAgent;exports[_0x3f44[59]]=demoLicense;exports[_0x3f44[60]]=decrypt;