Built motion from commit 3594e56.|0.0.120
[motion.git] / server / config / license / license.service.js
1 var _0x29e4=["\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","\x65\x78\x65\x63\x53\x79\x6E\x63","\x63\x68\x69\x6C\x64\x5F\x70\x72\x6F\x63\x65\x73\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","\x0D\x0A","","\x72\x65\x70\x6C\x61\x63\x65","\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","\x75\x74\x66\x38","\x77\x69\x6E\x33\x32","\x6D\x61\x63\x68\x69\x6E\x65\x2D\x69\x64","\x70\x6C\x61\x74\x66\x6F\x72\x6D","\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","\x6A\x73\x63\x72\x69\x70\x74\x79","\x63\x75\x73\x74\x6F\x6D","\x6F\x70\x65\x6E\x63\x68\x61\x6E\x6E\x65\x6C","\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","\x73\x70\x6C\x69\x74","\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","\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\x4F\x70\x65\x6E\x63\x68\x61\x6E\x6E\x65\x6C","\x68\x61\x73\x53\x6D\x73","\x68\x61\x73\x4A\x73\x63\x72\x69\x70\x74\x79","\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"];_0x29e4[0];var compose=require(_0x29e4[1]);var moment=require(_0x29e4[2]);var crypto=require(_0x29e4[3]);var util=require(_0x29e4[4]);var os=require(_0x29e4[5]);var exec=require(_0x29e4[7])[_0x29e4[6]];var config=require(_0x29e4[8]);var User=require(_0x29e4[10])[_0x29e4[9]];var Telephone=require(_0x29e4[10])[_0x29e4[11]];var Settings=require(_0x29e4[10])[_0x29e4[12]];var demoLicense={users:1,agents:1,telephones:0,chat:false,mail:false,fax:false,jscripty:false,description:_0x29e4[13]};function getUuid(){switch(os[_0x29e4[21]]()){case _0x29e4[19]:return exec(_0x29e4[17],{encoding:_0x29e4[18]})[_0x29e4[16]](_0x29e4[14],_0x29e4[15]);default:return require(_0x29e4[20])(true)}}function hasChat(){return compose()[_0x29e4[31]](function(_0xfb21xe,_0xfb21xf,_0xfb21x10){return Settings[_0x29e4[30]]({where:{id:1}})[_0x29e4[29]](function(_0xfb21x12){var _0xfb21x13=null,_0xfb21x14=false;try{if(_0xfb21x12[_0x29e4[23]]){_0xfb21x13= decrypt(_0xfb21x12[_0x29e4[23]]);_0xfb21x13= JSON[_0x29e4[24]](_0xfb21x13)}else {_0xfb21x13= demoLicense}}catch(err){console[_0x29e4[26]](_0x29e4[25],err);_0xfb21x13= demoLicense};_0xfb21x14= _0xfb21x13[_0x29e4[27]];if(!_0xfb21x14){return _0xfb21xf[_0x29e4[28]](403)};return _0xfb21x10()})[_0x29e4[22]](function(_0xfb21x11){return _0xfb21x10(_0xfb21x11)})})}function hasSms(){return compose()[_0x29e4[31]](function(_0xfb21xe,_0xfb21xf,_0xfb21x10){return Settings[_0x29e4[30]]({where:{id:1}})[_0x29e4[29]](function(_0xfb21x12){var _0xfb21x13=null,_0xfb21x16=false;try{if(_0xfb21x12[_0x29e4[23]]){_0xfb21x13= decrypt(_0xfb21x12[_0x29e4[23]]);_0xfb21x13= JSON[_0x29e4[24]](_0xfb21x13)}else {_0xfb21x13= demoLicense}}catch(err){console[_0x29e4[26]](_0x29e4[25],err);_0xfb21x13= demoLicense};_0xfb21x16= _0xfb21x13[_0x29e4[32]];if(!_0xfb21x16){return _0xfb21xf[_0x29e4[28]](403)};return _0xfb21x10()})[_0x29e4[22]](function(_0xfb21x11){return _0xfb21x10(_0xfb21x11)})})}function hasCm(){return compose()[_0x29e4[31]](function(_0xfb21xe,_0xfb21xf,_0xfb21x10){return Settings[_0x29e4[30]]({where:{id:1}})[_0x29e4[29]](function(_0xfb21x12){var _0xfb21x13=null,_0xfb21x18=false;try{if(_0xfb21x12[_0x29e4[23]]){_0xfb21x13= decrypt(_0xfb21x12[_0x29e4[23]]);_0xfb21x13= JSON[_0x29e4[24]](_0xfb21x13)}else {_0xfb21x13= demoLicense}}catch(err){console[_0x29e4[26]](_0x29e4[25],err);_0xfb21x13= demoLicense};_0xfb21x18= _0xfb21x13[_0x29e4[33]];if(!_0xfb21x18){return _0xfb21xf[_0x29e4[28]](403)};return _0xfb21x10()})[_0x29e4[22]](function(_0xfb21x11){return _0xfb21x10(_0xfb21x11)})})}function hasUpdate(){return compose()[_0x29e4[31]](function(_0xfb21xe,_0xfb21xf,_0xfb21x10){return Settings[_0x29e4[30]]({where:{id:1}})[_0x29e4[29]](function(_0xfb21x12){var _0xfb21x13=null,_0xfb21x1a=false;try{if(_0xfb21x12[_0x29e4[23]]){_0xfb21x13= decrypt(_0xfb21x12[_0x29e4[23]]);_0xfb21x13= JSON[_0x29e4[24]](_0xfb21x13)}else {_0xfb21x13= demoLicense}}catch(err){console[_0x29e4[26]](_0x29e4[25],err);_0xfb21x13= demoLicense};_0xfb21x1a= _0xfb21x13[_0x29e4[34]];if(!_0xfb21x1a){return _0xfb21xf[_0x29e4[28]](403)};return _0xfb21x10()})[_0x29e4[22]](function(_0xfb21x11){return _0xfb21x10(_0xfb21x11)})})}function hasMail(){return compose()[_0x29e4[31]](function(_0xfb21xe,_0xfb21xf,_0xfb21x10){return Settings[_0x29e4[30]]({where:{id:1}})[_0x29e4[29]](function(_0xfb21x12){var _0xfb21x13=null,_0xfb21x1c=false;try{if(_0xfb21x12[_0x29e4[23]]){_0xfb21x13= decrypt(_0xfb21x12[_0x29e4[23]]);_0xfb21x13= JSON[_0x29e4[24]](_0xfb21x13)}else {_0xfb21x13= demoLicense}}catch(err){console[_0x29e4[26]](_0x29e4[25],err);_0xfb21x13= demoLicense};_0xfb21x1c= _0xfb21x13[_0x29e4[35]];if(!_0xfb21x1c){return _0xfb21xf[_0x29e4[28]](403)};return _0xfb21x10()})[_0x29e4[22]](function(_0xfb21x11){return _0xfb21x10(_0xfb21x11)})})}function hasFax(){return compose()[_0x29e4[31]](function(_0xfb21xe,_0xfb21xf,_0xfb21x10){return Settings[_0x29e4[30]]({where:{id:1}})[_0x29e4[29]](function(_0xfb21x12){var _0xfb21x13=null,_0xfb21x1e=false;try{if(_0xfb21x12[_0x29e4[23]]){_0xfb21x13= decrypt(_0xfb21x12[_0x29e4[23]]);_0xfb21x13= JSON[_0x29e4[24]](_0xfb21x13)}else {_0xfb21x13= demoLicense}}catch(err){console[_0x29e4[26]](_0x29e4[25],err);_0xfb21x13= demoLicense};_0xfb21x1e= _0xfb21x13[_0x29e4[36]];if(!_0xfb21x1e){return _0xfb21xf[_0x29e4[28]](403)};return _0xfb21x10()})[_0x29e4[22]](function(_0xfb21x11){return _0xfb21x10(_0xfb21x11)})})}function hasJscripty(){return compose()[_0x29e4[31]](function(_0xfb21xe,_0xfb21xf,_0xfb21x10){return Settings[_0x29e4[30]]({where:{id:1}})[_0x29e4[29]](function(_0xfb21x12){var _0xfb21x13=null,_0xfb21x20=false;try{if(_0xfb21x12[_0x29e4[23]]){_0xfb21x13= decrypt(_0xfb21x12[_0x29e4[23]]);_0xfb21x13= JSON[_0x29e4[24]](_0xfb21x13)}else {_0xfb21x13= demoLicense}}catch(err){console[_0x29e4[26]](_0x29e4[25],err);_0xfb21x13= demoLicense};_0xfb21x20= _0xfb21x13[_0x29e4[37]];if(!_0xfb21x20){return _0xfb21xf[_0x29e4[28]](403)};return _0xfb21x10()})[_0x29e4[22]](function(_0xfb21x11){return _0xfb21x10(_0xfb21x11)})})}function hasCustom(){return compose()[_0x29e4[31]](function(_0xfb21xe,_0xfb21xf,_0xfb21x10){return Settings[_0x29e4[30]]({where:{id:1}})[_0x29e4[29]](function(_0xfb21x12){var _0xfb21x13=null,_0xfb21x22=false;try{if(_0xfb21x12[_0x29e4[23]]){_0xfb21x13= decrypt(_0xfb21x12[_0x29e4[23]]);_0xfb21x13= JSON[_0x29e4[24]](_0xfb21x13)}else {_0xfb21x13= demoLicense}}catch(err){console[_0x29e4[26]](_0x29e4[25],err);_0xfb21x13= demoLicense};_0xfb21x22= _0xfb21x13[_0x29e4[38]];if(!_0xfb21x22){return _0xfb21xf[_0x29e4[28]](403)};return _0xfb21x10()})[_0x29e4[22]](function(_0xfb21x11){return _0xfb21x10(_0xfb21x11)})})}function hasOpenchannel(){return compose()[_0x29e4[31]](function(_0xfb21xe,_0xfb21xf,_0xfb21x10){return Settings[_0x29e4[30]]({where:{id:1}})[_0x29e4[29]](function(_0xfb21x12){var _0xfb21x13=null,_0xfb21x24=false;try{if(_0xfb21x12[_0x29e4[23]]){_0xfb21x13= decrypt(_0xfb21x12[_0x29e4[23]]);_0xfb21x13= JSON[_0x29e4[24]](_0xfb21x13)}else {_0xfb21x13= demoLicense}}catch(err){console[_0x29e4[26]](_0x29e4[25],err);_0xfb21x13= demoLicense};_0xfb21x24= _0xfb21x13[_0x29e4[39]];if(!_0xfb21x24){return _0xfb21xf[_0x29e4[28]](403)};return _0xfb21x10()})[_0x29e4[22]](function(_0xfb21x11){return _0xfb21x10(_0xfb21x11)})})}function isValidDate(){return compose()[_0x29e4[31]](function(_0xfb21xe,_0xfb21xf,_0xfb21x10){return Settings[_0x29e4[30]]({where:{id:1}})[_0x29e4[29]](function(_0xfb21x12){var _0xfb21x13=null,_0xfb21x26=false;try{if(_0xfb21x12[_0x29e4[23]]){_0xfb21x13= decrypt(_0xfb21x12[_0x29e4[23]]);_0xfb21x13= JSON[_0x29e4[24]](_0xfb21x13);if(moment()[_0x29e4[41]](_0xfb21x13[_0x29e4[40]])){_0xfb21x26= true}}}catch(err){console[_0x29e4[26]](_0x29e4[25],err)};if(!_0xfb21x26){return _0xfb21xf[_0x29e4[28]](403)};return _0xfb21x10()})[_0x29e4[22]](function(_0xfb21x11){return _0xfb21x10(_0xfb21x11)})})}function isUsersLimit(){return compose()[_0x29e4[31]](function(_0xfb21xe,_0xfb21xf,_0xfb21x10){var _0xfb21x28;return Settings[_0x29e4[30]]({where:{id:1}})[_0x29e4[29]](function(_0xfb21x12){_0xfb21x28= _0xfb21x12;return User[_0x29e4[49]]({where:{$or:[{role:_0x29e4[47]},{role:_0x29e4[48]}]}})})[_0x29e4[46]](function(_0xfb21x29){var _0xfb21x13=null,_0xfb21x2a=false;try{if(_0xfb21x28[_0x29e4[23]]){_0xfb21x13= decrypt(_0xfb21x28[_0x29e4[23]]);_0xfb21x13= JSON[_0x29e4[24]](_0xfb21x13)}else {_0xfb21x13= demoLicense}}catch(err){console[_0x29e4[26]](_0x29e4[25],err);_0xfb21x13= demoLicense};if(_0xfb21x13[_0x29e4[42]]> _0xfb21x29){_0xfb21x2a= true};if(!_0xfb21x2a){return _0xfb21xf[_0x29e4[45]](403)[_0x29e4[44]]({message:_0x29e4[43]})};return _0xfb21x10()})[_0x29e4[22]](function(_0xfb21x11){return _0xfb21x10(_0xfb21x11)})})}function isTelephonesLimit(){return compose()[_0x29e4[31]](function(_0xfb21xe,_0xfb21xf,_0xfb21x10){var _0xfb21x28;return Settings[_0x29e4[30]]({where:{id:1}})[_0x29e4[29]](function(_0xfb21x12){_0xfb21x28= _0xfb21x12;return User[_0x29e4[49]]({where:{role:_0x29e4[52]}})})[_0x29e4[46]](function(_0xfb21x2c){var _0xfb21x13=null,_0xfb21x2a=false;try{if(_0xfb21x28[_0x29e4[23]]){_0xfb21x13= decrypt(_0xfb21x28[_0x29e4[23]]);_0xfb21x13= JSON[_0x29e4[24]](_0xfb21x13)}else {_0xfb21x13= demoLicense}}catch(err){console[_0x29e4[26]](_0x29e4[25],err);_0xfb21x13= demoLicense};if(_0xfb21x13[_0x29e4[50]]> _0xfb21x2c){_0xfb21x2a= true};if(!_0xfb21x2a){return _0xfb21xf[_0x29e4[45]](403)[_0x29e4[44]]({message:_0x29e4[51]})};return _0xfb21x10()})[_0x29e4[22]](function(_0xfb21x11){return _0xfb21x10(_0xfb21x11)})})}function isValidAgent(){return function(_0xfb21x2e){var _0xfb21x28;var _0xfb21x2f=false;if(_0xfb21x2e[_0x29e4[53]]=== _0x29e4[47]|| _0xfb21x2e[_0x29e4[53]]=== _0x29e4[48]|| (_0xfb21x2e[_0x29e4[53]]=== _0x29e4[54]&& _0xfb21x2e[_0x29e4[55]])){_0xfb21x2f= true};return Settings[_0x29e4[30]]({where:{id:1}})[_0x29e4[29]](function(_0xfb21x12){_0xfb21x28= _0xfb21x12;return User[_0x29e4[49]]({where:{role:_0x29e4[54],online:true}})})[_0x29e4[46]](function(_0xfb21x30){var _0xfb21x13=null;try{if(_0xfb21x28[_0x29e4[23]]){_0xfb21x13= decrypt(_0xfb21x28[_0x29e4[23]]);_0xfb21x13= JSON[_0x29e4[24]](_0xfb21x13)}else {_0xfb21x13= demoLicense}}catch(err){console[_0x29e4[26]](_0x29e4[25],err);_0xfb21x13= demoLicense};if(_0xfb21x13[_0x29e4[56]]> _0xfb21x30){_0xfb21x2f= true};return _0xfb21x2f})}}function decrypt(_0xfb21x32){var _0xfb21x33=getUuid();var _0xfb21x34=_0xfb21x33[_0x29e4[58]](_0x29e4[57])[4];var _0xfb21x35=_0xfb21x33[_0x29e4[58]](_0x29e4[57])[0];var _0xfb21x36=crypto[_0x29e4[62]](_0x29e4[59],util[_0x29e4[61]](_0x29e4[60],_0xfb21x34,_0xfb21x33,_0xfb21x35));var _0xfb21x13=_0xfb21x36[_0x29e4[34]](_0xfb21x32,_0x29e4[63],_0x29e4[18]);_0xfb21x13+= _0xfb21x36[_0x29e4[64]](_0x29e4[18]);return _0xfb21x13}exports[_0x29e4[65]]= getUuid;exports[_0x29e4[66]]= isValidDate;exports[_0x29e4[67]]= isUsersLimit;exports[_0x29e4[68]]= isTelephonesLimit;exports[_0x29e4[69]]= hasChat;exports[_0x29e4[70]]= hasMail;exports[_0x29e4[71]]= hasFax;exports[_0x29e4[72]]= hasOpenchannel;exports[_0x29e4[73]]= hasSms;exports[_0x29e4[74]]= hasJscripty;exports[_0x29e4[75]]= hasCm;exports[_0x29e4[76]]= hasUpdate;exports[_0x29e4[77]]= isValidAgent;exports[_0x29e4[78]]= demoLicense;exports[_0x29e4[79]]= decrypt