Built motion from commit (unavailable).|2.3.7
[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 _0xc96d=['machineUuid','getUuid','secrets','gray','add','grayReason','changed','disabled','2027-01-01T00:00:00.000Z','Breaking\x20license','data1','message','getLicense','License','find','checkLicense','crypto','util','lodash','moment','./hardware','license','License\x20key\x20value\x20not\x20found','data2','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','demo','uuid'];(function(_0x54b7fc,_0x5a8cb6){var _0x2195e7=function(_0x3dd717){while(--_0x3dd717){_0x54b7fc['push'](_0x54b7fc['shift']());}};_0x2195e7(++_0x5a8cb6);}(_0xc96d,0x178));var _0xdc96=function(_0xe19a8e,_0x18e1dc){_0xe19a8e=_0xe19a8e-0x0;var _0x449a5d=_0xc96d[_0xe19a8e];return _0x449a5d;};'use strict';var crypto=require(_0xdc96('0x0'));var util=require(_0xdc96('0x1'));var _=require(_0xdc96('0x2'));var moment=require(_0xdc96('0x3'));var hardware=require(_0xdc96('0x4'));var config=require('../environment');var db=require('../../mysqldb')['db'];function checkLicense(_0x2fe863,_0x389c1b){if(_0x2fe863){try{var _0x54563d=_0x389c1b||_0x2fe863[_0xdc96('0x5')];if(_['isEmpty'](_0x54563d)){throw new Error(_0xdc96('0x6'));}var _0x5157cf=_0x2fe863['data1'];var _0x388449=_0x2fe863[_0xdc96('0x7')];var _0x5a4f53=_0x5157cf[_0xdc96('0x8')]('-')[0x4];var _0x144108=_0x5157cf[_0xdc96('0x8')]('-')[0x0];var _0x31dfa4=crypto[_0xdc96('0x9')](_0xdc96('0xa'),util[_0xdc96('0xb')](_0xdc96('0xc'),_0x5a4f53,_0x5157cf,_0x144108));var _0x2bf8a4=_0x31dfa4[_0xdc96('0xd')](_0x54563d,_0xdc96('0xe'),_0xdc96('0xf'));_0x2bf8a4+=_0x31dfa4[_0xdc96('0x10')](_0xdc96('0xf'));var _0x2e2441=JSON[_0xdc96('0x11')](_0x2bf8a4);_0x2e2441[_0xdc96('0x12')]=![];_0x2e2441[_0xdc96('0x13')]=_0x5157cf;_0x2e2441[_0xdc96('0x14')]=hardware[_0xdc96('0x15')]();if(_0x388449){var _0x10d5e3=crypto[_0xdc96('0x9')]('aes-256-ctr',config[_0xdc96('0x16')]['session']);var _0x20cf63=_0x10d5e3[_0xdc96('0xd')](_0x388449,_0xdc96('0xe'),_0xdc96('0xf'));_0x20cf63+=_0x10d5e3[_0xdc96('0x10')](_0xdc96('0xf'));_0x2e2441[_0xdc96('0x17')]=_0x20cf63;_0x2e2441['deadline']=moment(_0x20cf63)[_0xdc96('0x18')](0x7,'days')[_0xdc96('0xb')]();_0x2e2441[_0xdc96('0x19')]=_0x2e2441[_0xdc96('0x13')]!=_0x2e2441[_0xdc96('0x14')]?_0xdc96('0x1a'):_0xdc96('0x1b');}return _0x2e2441;}catch(_0x5a46f8){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xdc96('0x1c'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xdc96('0x1d'),'uuid':_0x2fe863[_0xdc96('0x1e')],'machineUuid':hardware[_0xdc96('0x15')](),'message':_0x5a46f8[_0xdc96('0x1f')],'virtual':0x0,'voice':!![],'preferred':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Demo\x20license','uuid':_0x2fe863[_0xdc96('0x1e')],'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'preferred':![]};}exports[_0xdc96('0x20')]=function(_0x283696){return db[_0xdc96('0x21')][_0xdc96('0x22')](_['defaults'](_0x283696,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x5cfb21){return checkLicense(_0x5cfb21,null);});};exports[_0xdc96('0x23')]=checkLicense;