Built motion from commit 72c8a21.|1.0.15
[motion.git] / server / config / license / index.js
1 var _0x45f1=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x72\x65\x71\x75\x65\x73\x74\x2D\x70\x72\x6F\x6D\x69\x73\x65","\x63\x72\x79\x70\x74\x6F","\x6D\x6F\x6D\x65\x6E\x74","\x2E\x2F\x6C\x69\x63\x65\x6E\x73\x65\x2E\x73\x65\x72\x76\x69\x63\x65","\x2E\x2E\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x4C\x69\x63\x65\x6E\x73\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x73\x65\x73\x73\x69\x6F\x6E","\x61\x65\x73\x2D\x32\x35\x36\x2D\x63\x74\x72","\x73\x65\x63\x72\x65\x74","\x63\x72\x65\x61\x74\x65\x43\x69\x70\x68\x65\x72","\x75\x74\x66\x38","\x62\x61\x73\x65\x36\x34","\x75\x70\x64\x61\x74\x65","\x66\x69\x6E\x61\x6C","\x63\x72\x65\x61\x74\x65\x44\x65\x63\x69\x70\x68\x65\x72","\x67\x65\x74","\x66\x69\x6E\x61\x6C\x6C\x79","\x73\x74\x72\x69\x6E\x67\x69\x66\x79","\x6C\x6F\x67","\x63\x61\x74\x63\x68","\x74\x68\x65\x6E","\x61\x63\x74\x69\x76\x65","\x6C\x69\x63\x65\x6E\x73\x65","\x64\x61\x74\x61\x32","\x64\x61\x79\x73","\x64\x69\x66\x66","\x64\x65\x6D\x6F","\x73\x74\x61\x72\x74\x20\x67\x72\x61\x79\x20\x70\x65\x72\x69\x6F\x64","\x59\x59\x59\x59\x2D\x4D\x4D\x2D\x44\x44\x20\x48\x48\x3A\x6D\x6D","\x66\x6F\x72\x6D\x61\x74","\x70\x72\x6F\x76\x69\x73\x69\x6F\x6E\x69\x6E\x67","\x2F\x73\x65\x72\x76\x65\x72\x73\x2F","\x2F\x63\x68\x65\x63\x6B","\x67\x65\x74\x55\x75\x69\x64","\x73\x74\x61\x72\x74\x20\x63\x68\x65\x63\x6B\x20\x6C\x69\x63\x65\x6E\x73\x65","\x73\x70\x72\x65\x61\x64","\x66\x69\x6E\x64\x4F\x72\x43\x72\x65\x61\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0x45f1[0];var rp=require(_0x45f1[1]);var crypto=require(_0x45f1[2]);var moment=require(_0x45f1[3]);var licenseService=require(_0x45f1[4]);var config=require(_0x45f1[5]);var License=require(_0x45f1[7])[_0x45f1[6]];var session=config[_0x45f1[8]];const expirationTh=7;var TIME=60* 1000;function encryptDate(_0x9fb1xb){var _0x9fb1xc=crypto[_0x45f1[11]](_0x45f1[9],session[_0x45f1[10]]);var _0x9fb1xd=_0x9fb1xc[_0x45f1[14]](_0x9fb1xb,_0x45f1[12],_0x45f1[13]);_0x9fb1xd+= _0x9fb1xc[_0x45f1[15]](_0x45f1[13]);return _0x9fb1xd}function decryptDate(_0x9fb1xb){var _0x9fb1xf=crypto[_0x45f1[16]](_0x45f1[9],session[_0x45f1[10]]);var _0x9fb1xd=_0x9fb1xf[_0x45f1[14]](_0x9fb1xb,_0x45f1[13],_0x45f1[12]);_0x9fb1xd+= _0x9fb1xf[_0x45f1[15]](_0x45f1[12]);return _0x9fb1xd}function checkLicense(_0x9fb1x11,_0x9fb1x12){var _0x9fb1x13=_0x9fb1x12[_0x45f1[17]]({plain:true});rp({uri:config[_0x45f1[32]]+ _0x45f1[33]+ _0x9fb1x11+ _0x45f1[34],json:true})[_0x45f1[22]](function(_0x9fb1x16){if(_0x9fb1x16[_0x45f1[23]]){return _0x9fb1x12[_0x45f1[14]]({data1:_0x9fb1x11,data2:null,license:_0x9fb1x16[_0x45f1[24]]})}else {if(_0x9fb1x13[_0x45f1[25]]){if(moment()[_0x45f1[27]](decryptDate(_0x9fb1x13[_0x45f1[25]]),_0x45f1[26])> expirationTh){console[_0x45f1[20]](_0x45f1[28]);return _0x9fb1x12[_0x45f1[14]]({data1:_0x9fb1x11,data2:null,license:null})}}else {if(_0x9fb1x13[_0x45f1[24]]){console[_0x45f1[20]](_0x45f1[29]);return _0x9fb1x12[_0x45f1[14]]({data2:encryptDate(moment()[_0x45f1[31]](_0x45f1[30]))})}}};return _0x9fb1x12})[_0x45f1[22]](function(_0x9fb1x15){_0x9fb1x12= _0x9fb1x15})[_0x45f1[21]](function(_0x9fb1x14){console[_0x45f1[20]](JSON[_0x45f1[19]](_0x9fb1x14))})[_0x45f1[18]](function(){setTimeout(function(){checkLicense(_0x9fb1x11,_0x9fb1x12)},TIME)})}function licenseManager(){var _0x9fb1x11=licenseService[_0x45f1[35]]();if(_0x9fb1x11){return License[_0x45f1[38]]({where:{id:1},defaults:{data1:_0x9fb1x11}})[_0x45f1[37]](function(_0x9fb1x12,_0x9fb1x18){console[_0x45f1[20]](_0x45f1[36]);checkLicense(_0x9fb1x11,_0x9fb1x12)})[_0x45f1[21]](function(_0x9fb1x14){console[_0x45f1[20]](JSON[_0x45f1[19]](_0x9fb1x14))})}}module[_0x45f1[39]]= licenseManager