Built motion from commit 1243baf.|0.0.90
[motion.git] / server / config / license / license.service.js
1 var _0xdd63=["\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","\x6F\x73","\x2E\x2E\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\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","\x70\x6C\x61\x74\x66\x6F\x72\x6D","\x6C\x69\x6E\x75\x78","\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","\x73\x6C\x69\x63\x65","\x0A","\x73\x70\x6C\x69\x74","\x62\x6C\x6B\x69\x64\x20\x2D\x67\x20\x26\x26\x20\x62\x6C\x6B\x69\x64","\x6D\x61\x74\x63\x68","\x74\x6F\x4C\x6F\x77\x65\x72\x43\x61\x73\x65","\x65\x78\x65\x63","\x6D\x61\x70","\x75\x75\x69\x64","\x63\x61\x74\x63\x68","\x6C\x69\x63\x65\x6E\x73\x65","\x70\x61\x72\x73\x65","\x64\x65\x63\x72\x79\x70\x74\x20\x65\x72\x72\x6F\x72","\x6C\x6F\x67","\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\x65\x73\x73\x61\x67\x69\x6E\x67","\x63\x6D","\x75\x70\x64\x61\x74\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","\x2D","\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","\x66\x69\x6E\x61\x6C","\x67\x65\x74\x55\x75\x69\x64","\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","\x68\x61\x73\x53\x6D\x73","\x68\x61\x73\x43\x6D","\x68\x61\x73\x55\x70\x64\x61\x74\x65","\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"];_0xdd63[0];var compose=require(_0xdd63[1]);var moment=require(_0xdd63[2]);var crypto=require(_0xdd63[3]);var util=require(_0xdd63[4]);var os=require(_0xdd63[5]);var config=require(_0xdd63[6]);var User=require(_0xdd63[8])[_0xdd63[7]];var Telephone=require(_0xdd63[8])[_0xdd63[9]];var Settings=require(_0xdd63[8])[_0xdd63[10]];var demoLicense={users:1,agents:1,telephones:0,chat:false,mail:false,fax:false,description:_0xdd63[11]};function getUuid(){if(os[_0xdd63[12]]()!==_0xdd63[13]){var _0x3f1dxc=exec(_0xdd63[15],{silent:true})[_0xdd63[14]];var _0x3f1dxd=_0x3f1dxc[_0xdd63[18]](_0xdd63[17])[_0xdd63[16]](0,-1);return _0x3f1dxd[0]}else {var _0x3f1dxc=exec(_0xdd63[19],{silent:true})[_0xdd63[14]];var _0x3f1dxd=_0x3f1dxc[_0xdd63[18]](_0xdd63[17])[_0xdd63[16]](0,-1)[_0xdd63[23]](function(_0x3f1dxe){var _0x3f1dxf,_0x3f1dx10,_0x3f1dxd;_0x3f1dx10= new RegExp(/(\w+)\=\"([^\"]+)/g);_0x3f1dxf={partition:_0x3f1dxe[_0xdd63[20]](/^(\S+)\:\ /)[1]};while(_0x3f1dxd=_0x3f1dx10[_0xdd63[22]](_0x3f1dxe)){_0x3f1dxf[_0x3f1dxd[1][_0xdd63[21]]()]=_0x3f1dxd[2]};return _0x3f1dxf});return _0x3f1dxd[0][_0xdd63[24]]}}function hasChat(){return compose()[_0xdd63[34]](function(_0x3f1dx12,_0x3f1dx13,_0x3f1dx14){return Settings[_0xdd63[33]]({where:{id:1}})[_0xdd63[32]](function(_0x3f1dx16){var _0x3f1dx17=null,_0x3f1dx18=false;try{if(_0x3f1dx16[_0xdd63[26]]){_0x3f1dx17=decrypt(_0x3f1dx16[_0xdd63[26]]);_0x3f1dx17=JSON[_0xdd63[27]](_0x3f1dx17)}else {_0x3f1dx17=demoLicense}}catch(err){console[_0xdd63[29]](_0xdd63[28],err);_0x3f1dx17=demoLicense};_0x3f1dx18=_0x3f1dx17[_0xdd63[30]];if(!_0x3f1dx18){return _0x3f1dx13[_0xdd63[31]](403)};return _0x3f1dx14()})[_0xdd63[25]](function(_0x3f1dx15){return _0x3f1dx14(_0x3f1dx15)})})}function hasSms(){return compose()[_0xdd63[34]](function(_0x3f1dx12,_0x3f1dx13,_0x3f1dx14){return Settings[_0xdd63[33]]({where:{id:1}})[_0xdd63[32]](function(_0x3f1dx16){var _0x3f1dx17=null,_0x3f1dx1a=false;try{if(_0x3f1dx16[_0xdd63[26]]){_0x3f1dx17=decrypt(_0x3f1dx16[_0xdd63[26]]);_0x3f1dx17=JSON[_0xdd63[27]](_0x3f1dx17)}else {_0x3f1dx17=demoLicense}}catch(err){console[_0xdd63[29]](_0xdd63[28],err);_0x3f1dx17=demoLicense};_0x3f1dx1a=_0x3f1dx17[_0xdd63[35]];if(!_0x3f1dx1a){return _0x3f1dx13[_0xdd63[31]](403)};return _0x3f1dx14()})[_0xdd63[25]](function(_0x3f1dx15){return _0x3f1dx14(_0x3f1dx15)})})}function hasCm(){return compose()[_0xdd63[34]](function(_0x3f1dx12,_0x3f1dx13,_0x3f1dx14){return Settings[_0xdd63[33]]({where:{id:1}})[_0xdd63[32]](function(_0x3f1dx16){var _0x3f1dx17=null,_0x3f1dx1c=false;try{if(_0x3f1dx16[_0xdd63[26]]){_0x3f1dx17=decrypt(_0x3f1dx16[_0xdd63[26]]);_0x3f1dx17=JSON[_0xdd63[27]](_0x3f1dx17)}else {_0x3f1dx17=demoLicense}}catch(err){console[_0xdd63[29]](_0xdd63[28],err);_0x3f1dx17=demoLicense};_0x3f1dx1c=_0x3f1dx17[_0xdd63[36]];if(!_0x3f1dx1c){return _0x3f1dx13[_0xdd63[31]](403)};return _0x3f1dx14()})[_0xdd63[25]](function(_0x3f1dx15){return _0x3f1dx14(_0x3f1dx15)})})}function hasUpdate(){return compose()[_0xdd63[34]](function(_0x3f1dx12,_0x3f1dx13,_0x3f1dx14){return Settings[_0xdd63[33]]({where:{id:1}})[_0xdd63[32]](function(_0x3f1dx16){var _0x3f1dx17=null,_0x3f1dx1e=false;try{if(_0x3f1dx16[_0xdd63[26]]){_0x3f1dx17=decrypt(_0x3f1dx16[_0xdd63[26]]);_0x3f1dx17=JSON[_0xdd63[27]](_0x3f1dx17)}else {_0x3f1dx17=demoLicense}}catch(err){console[_0xdd63[29]](_0xdd63[28],err);_0x3f1dx17=demoLicense};_0x3f1dx1e=_0x3f1dx17[_0xdd63[37]];if(!_0x3f1dx1e){return _0x3f1dx13[_0xdd63[31]](403)};return _0x3f1dx14()})[_0xdd63[25]](function(_0x3f1dx15){return _0x3f1dx14(_0x3f1dx15)})})}function hasMail(){return compose()[_0xdd63[34]](function(_0x3f1dx12,_0x3f1dx13,_0x3f1dx14){return Settings[_0xdd63[33]]({where:{id:1}})[_0xdd63[32]](function(_0x3f1dx16){var _0x3f1dx17=null,_0x3f1dx20=false;try{if(_0x3f1dx16[_0xdd63[26]]){_0x3f1dx17=decrypt(_0x3f1dx16[_0xdd63[26]]);_0x3f1dx17=JSON[_0xdd63[27]](_0x3f1dx17)}else {_0x3f1dx17=demoLicense}}catch(err){console[_0xdd63[29]](_0xdd63[28],err);_0x3f1dx17=demoLicense};_0x3f1dx20=_0x3f1dx17[_0xdd63[38]];if(!_0x3f1dx20){return _0x3f1dx13[_0xdd63[31]](403)};return _0x3f1dx14()})[_0xdd63[25]](function(_0x3f1dx15){return _0x3f1dx14(_0x3f1dx15)})})}function hasFax(){return compose()[_0xdd63[34]](function(_0x3f1dx12,_0x3f1dx13,_0x3f1dx14){return Settings[_0xdd63[33]]({where:{id:1}})[_0xdd63[32]](function(_0x3f1dx16){var _0x3f1dx17=null,_0x3f1dx22=false;try{if(_0x3f1dx16[_0xdd63[26]]){_0x3f1dx17=decrypt(_0x3f1dx16[_0xdd63[26]]);_0x3f1dx17=JSON[_0xdd63[27]](_0x3f1dx17)}else {_0x3f1dx17=demoLicense}}catch(err){console[_0xdd63[29]](_0xdd63[28],err);_0x3f1dx17=demoLicense};_0x3f1dx22=_0x3f1dx17[_0xdd63[39]];if(!_0x3f1dx22){return _0x3f1dx13[_0xdd63[31]](403)};return _0x3f1dx14()})[_0xdd63[25]](function(_0x3f1dx15){return _0x3f1dx14(_0x3f1dx15)})})}function isValidDate(){return compose()[_0xdd63[34]](function(_0x3f1dx12,_0x3f1dx13,_0x3f1dx14){return Settings[_0xdd63[33]]({where:{id:1}})[_0xdd63[32]](function(_0x3f1dx16){var _0x3f1dx17=null,_0x3f1dx24=false;try{if(_0x3f1dx16[_0xdd63[26]]){_0x3f1dx17=decrypt(_0x3f1dx16[_0xdd63[26]]);_0x3f1dx17=JSON[_0xdd63[27]](_0x3f1dx17);if(moment()[_0xdd63[41]](_0x3f1dx17[_0xdd63[40]])){_0x3f1dx24=true}}}catch(err){console[_0xdd63[29]](_0xdd63[28],err)};if(!_0x3f1dx24){return _0x3f1dx13[_0xdd63[31]](403)};return _0x3f1dx14()})[_0xdd63[25]](function(_0x3f1dx15){return _0x3f1dx14(_0x3f1dx15)})})}function isUsersLimit(){return compose()[_0xdd63[34]](function(_0x3f1dx12,_0x3f1dx13,_0x3f1dx14){var _0x3f1dx26;return Settings[_0xdd63[33]]({where:{id:1}})[_0xdd63[32]](function(_0x3f1dx16){_0x3f1dx26=_0x3f1dx16;return User[_0xdd63[49]]({where:{$or:[{role:_0xdd63[47]},{role:_0xdd63[48]}]}})})[_0xdd63[46]](function(_0x3f1dx27){var _0x3f1dx17=null,_0x3f1dx28=false;try{if(_0x3f1dx26[_0xdd63[26]]){_0x3f1dx17=decrypt(_0x3f1dx26[_0xdd63[26]]);_0x3f1dx17=JSON[_0xdd63[27]](_0x3f1dx17)}else {_0x3f1dx17=demoLicense}}catch(err){console[_0xdd63[29]](_0xdd63[28],err);_0x3f1dx17=demoLicense};if(_0x3f1dx17[_0xdd63[42]]>_0x3f1dx27){_0x3f1dx28=true};if(!_0x3f1dx28){return _0x3f1dx13[_0xdd63[45]](403)[_0xdd63[44]]({message:_0xdd63[43]})};return _0x3f1dx14()})[_0xdd63[25]](function(_0x3f1dx15){return _0x3f1dx14(_0x3f1dx15)})})}function isTelephonesLimit(){return compose()[_0xdd63[34]](function(_0x3f1dx12,_0x3f1dx13,_0x3f1dx14){var _0x3f1dx26;return Settings[_0xdd63[33]]({where:{id:1}})[_0xdd63[32]](function(_0x3f1dx16){_0x3f1dx26=_0x3f1dx16;return User[_0xdd63[49]]({where:{role:_0xdd63[52]}})})[_0xdd63[46]](function(_0x3f1dx2a){var _0x3f1dx17=null,_0x3f1dx28=false;try{if(_0x3f1dx26[_0xdd63[26]]){_0x3f1dx17=decrypt(_0x3f1dx26[_0xdd63[26]]);_0x3f1dx17=JSON[_0xdd63[27]](_0x3f1dx17)}else {_0x3f1dx17=demoLicense}}catch(err){console[_0xdd63[29]](_0xdd63[28],err);_0x3f1dx17=demoLicense};if(_0x3f1dx17[_0xdd63[50]]>_0x3f1dx2a){_0x3f1dx28=true};if(!_0x3f1dx28){return _0x3f1dx13[_0xdd63[45]](403)[_0xdd63[44]]({message:_0xdd63[51]})};return _0x3f1dx14()})[_0xdd63[25]](function(_0x3f1dx15){return _0x3f1dx14(_0x3f1dx15)})})}function isValidAgent(){return function(_0x3f1dx2c){var _0x3f1dx26;var _0x3f1dx2d=false;if(_0x3f1dx2c[_0xdd63[53]]===_0xdd63[47]||_0x3f1dx2c[_0xdd63[53]]===_0xdd63[48]||(_0x3f1dx2c[_0xdd63[53]]===_0xdd63[54]&&_0x3f1dx2c[_0xdd63[55]])){_0x3f1dx2d=true};return Settings[_0xdd63[33]]({where:{id:1}})[_0xdd63[32]](function(_0x3f1dx16){_0x3f1dx26=_0x3f1dx16;return User[_0xdd63[49]]({where:{role:_0xdd63[54],online:true}})})[_0xdd63[46]](function(_0x3f1dx2e){var _0x3f1dx17=null;try{if(_0x3f1dx26[_0xdd63[26]]){_0x3f1dx17=decrypt(_0x3f1dx26[_0xdd63[26]]);_0x3f1dx17=JSON[_0xdd63[27]](_0x3f1dx17)}else {_0x3f1dx17=demoLicense}}catch(err){console[_0xdd63[29]](_0xdd63[28],err);_0x3f1dx17=demoLicense};if(_0x3f1dx17[_0xdd63[56]]>_0x3f1dx2e){_0x3f1dx2d=true};return _0x3f1dx2d})}}function decrypt(_0x3f1dx30){var _0x3f1dx31=getUuid();var _0x3f1dx32=_0x3f1dx31[_0xdd63[18]](_0xdd63[57])[4];var _0x3f1dx33=_0x3f1dx31[_0xdd63[18]](_0xdd63[57])[0];var _0x3f1dx34=crypto[_0xdd63[61]](_0xdd63[58],util[_0xdd63[60]](_0xdd63[59],_0x3f1dx32,_0x3f1dx31,_0x3f1dx33));var _0x3f1dx17=_0x3f1dx34[_0xdd63[37]](_0x3f1dx30,_0xdd63[62],_0xdd63[63]);_0x3f1dx17+=_0x3f1dx34[_0xdd63[64]](_0xdd63[63]);return _0x3f1dx17}exports[_0xdd63[65]]=getUuid;exports[_0xdd63[66]]=isValidDate;exports[_0xdd63[67]]=isUsersLimit;exports[_0xdd63[68]]=isTelephonesLimit;exports[_0xdd63[69]]=hasChat;exports[_0xdd63[70]]=hasMail;exports[_0xdd63[71]]=hasFax;exports[_0xdd63[72]]=hasSms;exports[_0xdd63[73]]=hasCm;exports[_0xdd63[74]]=hasUpdate;exports[_0xdd63[75]]=isValidAgent;exports[_0xdd63[76]]=demoLicense;exports[_0xdd63[77]]=decrypt