Built motion from commit (unavailable).|2.4.18
[motion2.git] / server / config / license / util.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x8835=['moment','./hardware','../environment','license','License\x20key\x20value\x20not\x20found','data1','data2','split','aes-256-ctr','format','update','base64','utf8','final','parse','demo','uuid','machineUuid','getUuid','createDecipher','secrets','session','gray','add','days','grayReason','disabled','2027-01-01T00:00:00.000Z','getLicense','License','find','then','crypto','util','lodash'];(function(_0x166d38,_0x46e636){var _0x4becf7=function(_0x167074){while(--_0x167074){_0x166d38['push'](_0x166d38['shift']());}};_0x4becf7(++_0x46e636);}(_0x8835,0x15b));var _0x5883=function(_0x344432,_0x5b990f){_0x344432=_0x344432-0x0;var _0x54f671=_0x8835[_0x344432];return _0x54f671;};'use strict';var crypto=require(_0x5883('0x0'));var util=require(_0x5883('0x1'));var _=require(_0x5883('0x2'));var moment=require(_0x5883('0x3'));var hardware=require(_0x5883('0x4'));var config=require(_0x5883('0x5'));var db=require('../../mysqldb')['db'];function checkLicense(_0x4a9a25,_0x51d888){if(_0x4a9a25){try{var _0x4da547=_0x51d888||_0x4a9a25[_0x5883('0x6')];if(_['isEmpty'](_0x4da547)){throw new Error(_0x5883('0x7'));}var _0x23a3a=_0x4a9a25[_0x5883('0x8')];var _0x2aecd1=_0x4a9a25[_0x5883('0x9')];var _0x20d4e9=_0x23a3a[_0x5883('0xa')]('-')[0x4];var _0x467f83=_0x23a3a[_0x5883('0xa')]('-')[0x0];var _0x453c8d=crypto['createDecipher'](_0x5883('0xb'),util[_0x5883('0xc')]('%s:%s:%s',_0x20d4e9,_0x23a3a,_0x467f83));var _0x259d41=_0x453c8d[_0x5883('0xd')](_0x4da547,_0x5883('0xe'),_0x5883('0xf'));_0x259d41+=_0x453c8d[_0x5883('0x10')](_0x5883('0xf'));var _0x197efd=JSON[_0x5883('0x11')](_0x259d41);_0x197efd[_0x5883('0x12')]=![];_0x197efd[_0x5883('0x13')]=_0x23a3a;_0x197efd[_0x5883('0x14')]=hardware[_0x5883('0x15')]();if(_0x2aecd1){var _0x3f641f=crypto[_0x5883('0x16')]('aes-256-ctr',config[_0x5883('0x17')][_0x5883('0x18')]);var _0x3059ba=_0x3f641f[_0x5883('0xd')](_0x2aecd1,_0x5883('0xe'),_0x5883('0xf'));_0x3059ba+=_0x3f641f[_0x5883('0x10')](_0x5883('0xf'));_0x197efd[_0x5883('0x19')]=_0x3059ba;_0x197efd['deadline']=moment(_0x3059ba)[_0x5883('0x1a')](0x7,_0x5883('0x1b'))['format']();_0x197efd[_0x5883('0x1c')]=_0x197efd[_0x5883('0x13')]!=_0x197efd['machineUuid']?'changed':_0x5883('0x1d');}return _0x197efd;}catch(_0x546556){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x5883('0x1e'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','uuid':_0x4a9a25[_0x5883('0x8')],'machineUuid':hardware['getUuid'](),'message':_0x546556['message'],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x5883('0x1e'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','uuid':_0x4a9a25[_0x5883('0x8')],'machineUuid':hardware[_0x5883('0x15')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![]};}exports[_0x5883('0x1f')]=function(_0x47cf54){return db[_0x5883('0x20')][_0x5883('0x21')](_['defaults'](_0x47cf54,{'raw':!![],'where':{'id':0x1}}))[_0x5883('0x22')](function(_0x51b480){return checkLicense(_0x51b480,null);});};exports['checkLicense']=checkLicense;