6c09f5ab5b19c0f88b27effc52ade23d1ef305a8
[motion.git] / server / config / license / index.js
1 var _0x72a4=["\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","\x6D\x6F\x74\x69\x6F\x6E","\x2E\x2E\x2F\x6C\x6F\x67\x67\x65\x72\x2E\x6A\x73","\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","\x2E\x2E\x2F\x2E\x2E\x2F\x2E\x2E\x2F\x70\x61\x63\x6B\x61\x67\x65\x2E\x6A\x73\x6F\x6E","\x66\x69\x6E\x61\x6C\x6C\x79","\x45\x72\x72\x6F\x72\x20\x64\x75\x72\x69\x6E\x67\x20\x63\x68\x65\x63\x6B\x20\x6C\x69\x63\x65\x6E\x73\x65\x20\x70\x72\x6F\x63\x65\x73\x73","\x65\x72\x72\x6F\x72","\x73\x74\x61\x63\x6B","\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","\x41\x74\x74\x65\x6E\x74\x69\x6F\x6E\x21\x20\x47\x72\x65\x79\x20\x70\x65\x72\x69\x6F\x64\x20\x65\x78\x70\x69\x72\x65\x64\x3A\x20\x44\x65\x6D\x6F\x20\x6C\x69\x63\x65\x6E\x73\x65\x20\x61\x70\x70\x6C\x69\x65\x64\x21","\x77\x61\x72\x6E","\x41\x74\x74\x65\x6E\x74\x69\x6F\x6E\x21\x20\x54\x6F\x6B\x65\x6E\x20\x63\x68\x61\x6E\x67\x65\x64\x20\x6F\x72\x20\x6C\x69\x63\x65\x6E\x73\x65\x20\x64\x65\x61\x63\x74\x69\x76\x61\x74\x65\x64\x3A\x20\x47\x72\x65\x79\x20\x70\x65\x72\x69\x6F\x64\x20\x73\x74\x61\x72\x74\x65\x64\x21","\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","\x76\x65\x72\x73\x69\x6F\x6E","\x67\x65\x74\x55\x75\x69\x64","\x43\x68\x65\x63\x6B\x69\x6E\x67\x20\x6C\x69\x63\x65\x6E\x73\x65\x2E\x2E\x2E","\x64\x65\x62\x75\x67","\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"];_0x72a4[0];var rp=require(_0x72a4[1]);var crypto=require(_0x72a4[2]);var moment=require(_0x72a4[3]);var licenseService=require(_0x72a4[4]);var config=require(_0x72a4[5]);var License=require(_0x72a4[7])[_0x72a4[6]];var session=config[_0x72a4[8]];var logger=require(_0x72a4[10])(_0x72a4[9]);const expirationTh=7;var TIME=60* 1000;function encryptDate(_0xcfbfxc){var _0xcfbfxd=crypto[_0x72a4[13]](_0x72a4[11],session[_0x72a4[12]]);var _0xcfbfxe=_0xcfbfxd[_0x72a4[16]](_0xcfbfxc,_0x72a4[14],_0x72a4[15]);_0xcfbfxe+= _0xcfbfxd[_0x72a4[17]](_0x72a4[15]);return _0xcfbfxe}function decryptDate(_0xcfbfxc){var _0xcfbfx10=crypto[_0x72a4[18]](_0x72a4[11],session[_0x72a4[12]]);var _0xcfbfxe=_0xcfbfx10[_0x72a4[16]](_0xcfbfxc,_0x72a4[15],_0x72a4[14]);_0xcfbfxe+= _0xcfbfx10[_0x72a4[17]](_0x72a4[14]);return _0xcfbfxe}function checkLicense(_0xcfbfx12,_0xcfbfx13){var _0xcfbfx14=_0xcfbfx13[_0x72a4[19]]({plain:true});var _0xcfbfx15=require(_0x72a4[20]);rp({uri:config[_0x72a4[37]]+ _0x72a4[38]+ _0xcfbfx12+ _0x72a4[39],qs:{version:_0xcfbfx15[_0x72a4[40]]},json:true})[_0x72a4[26]](function(_0xcfbfx18){if(_0xcfbfx18[_0x72a4[27]]){return _0xcfbfx13[_0x72a4[16]]({data1:_0xcfbfx12,data2:null,license:_0xcfbfx18[_0x72a4[28]]})}else {if(_0xcfbfx14[_0x72a4[29]]){if(moment()[_0x72a4[31]](decryptDate(_0xcfbfx14[_0x72a4[29]]),_0x72a4[30])> expirationTh){logger[_0x72a4[33]](_0x72a4[32]);return _0xcfbfx13[_0x72a4[16]]({data1:_0xcfbfx12,data2:null,license:null})}}else {if(_0xcfbfx14[_0x72a4[28]]){logger[_0x72a4[33]](_0x72a4[34]);return _0xcfbfx13[_0x72a4[16]]({data2:encryptDate(moment()[_0x72a4[36]](_0x72a4[35]))})}}};return _0xcfbfx13})[_0x72a4[26]](function(_0xcfbfx17){_0xcfbfx13= _0xcfbfx17})[_0x72a4[25]](function(_0xcfbfx16){logger[_0x72a4[23]](_0x72a4[22]);logger[_0x72a4[23]](_0xcfbfx16[_0x72a4[24]])})[_0x72a4[21]](function(){setTimeout(function(){checkLicense(_0xcfbfx12,_0xcfbfx13)},TIME)})}function licenseManager(){var _0xcfbfx12=licenseService[_0x72a4[41]]();if(_0xcfbfx12){return License[_0x72a4[45]]({where:{id:1},defaults:{data1:_0xcfbfx12}})[_0x72a4[44]](function(_0xcfbfx13,_0xcfbfx1a){logger[_0x72a4[43]](_0x72a4[42]);checkLicense(_0xcfbfx12,_0xcfbfx13)})[_0x72a4[25]](function(_0xcfbfx16){logger[_0x72a4[23]](_0xcfbfx16[_0x72a4[24]])})}}module[_0x72a4[46]]= licenseManager