Built motion from commit (unavailable).|2.5.3
[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 _0xa2d7=['2027-01-01T00:00:00.000Z','Breaking\x20license','message','Demo\x20license','License','then','checkLicense','crypto','util','lodash','moment','../environment','../../mysqldb','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','aes-256-ctr','format','utf8','final','parse','demo','uuid','machineUuid','getUuid','secrets','session','update','gray','deadline','add','changed','disabled'];(function(_0x1807ee,_0x489705){var _0x122fed=function(_0x12252e){while(--_0x12252e){_0x1807ee['push'](_0x1807ee['shift']());}};_0x122fed(++_0x489705);}(_0xa2d7,0xbb));var _0x7a2d=function(_0x1fa272,_0x1c96f4){_0x1fa272=_0x1fa272-0x0;var _0x14d4ac=_0xa2d7[_0x1fa272];return _0x14d4ac;};'use strict';var crypto=require(_0x7a2d('0x0'));var util=require(_0x7a2d('0x1'));var _=require(_0x7a2d('0x2'));var moment=require(_0x7a2d('0x3'));var hardware=require('./hardware');var config=require(_0x7a2d('0x4'));var db=require(_0x7a2d('0x5'))['db'];function checkLicense(_0x2de08b,_0x43a277){if(_0x2de08b){try{var _0x576623=_0x43a277||_0x2de08b[_0x7a2d('0x6')];if(_[_0x7a2d('0x7')](_0x576623)){throw new Error(_0x7a2d('0x8'));}var _0x5161c4=_0x2de08b[_0x7a2d('0x9')];var _0x2d7b89=_0x2de08b[_0x7a2d('0xa')];var _0x3c5aea=_0x5161c4['split']('-')[0x4];var _0x13399c=_0x5161c4[_0x7a2d('0xb')]('-')[0x0];var _0x455002=crypto['createDecipher'](_0x7a2d('0xc'),util[_0x7a2d('0xd')]('%s:%s:%s',_0x3c5aea,_0x5161c4,_0x13399c));var _0x4d36d1=_0x455002['update'](_0x576623,'base64',_0x7a2d('0xe'));_0x4d36d1+=_0x455002[_0x7a2d('0xf')](_0x7a2d('0xe'));var _0x47afc3=JSON[_0x7a2d('0x10')](_0x4d36d1);_0x47afc3[_0x7a2d('0x11')]=![];_0x47afc3[_0x7a2d('0x12')]=_0x5161c4;_0x47afc3[_0x7a2d('0x13')]=hardware[_0x7a2d('0x14')]();if(_0x2d7b89){var _0x148286=crypto['createDecipher'](_0x7a2d('0xc'),config[_0x7a2d('0x15')][_0x7a2d('0x16')]);var _0x28decd=_0x148286[_0x7a2d('0x17')](_0x2d7b89,'base64',_0x7a2d('0xe'));_0x28decd+=_0x148286[_0x7a2d('0xf')](_0x7a2d('0xe'));_0x47afc3[_0x7a2d('0x18')]=_0x28decd;_0x47afc3[_0x7a2d('0x19')]=moment(_0x28decd)[_0x7a2d('0x1a')](0x7,'days')[_0x7a2d('0xd')]();_0x47afc3['grayReason']=_0x47afc3[_0x7a2d('0x12')]!=_0x47afc3[_0x7a2d('0x13')]?_0x7a2d('0x1b'):_0x7a2d('0x1c');}return _0x47afc3;}catch(_0x4e4ebc){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x7a2d('0x1d'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x7a2d('0x1e'),'uuid':_0x2de08b[_0x7a2d('0x9')],'machineUuid':hardware[_0x7a2d('0x14')](),'message':_0x4e4ebc[_0x7a2d('0x1f')],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x7a2d('0x1d'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x7a2d('0x20'),'uuid':_0x2de08b['data1'],'machineUuid':hardware[_0x7a2d('0x14')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}exports['getLicense']=function(_0x4fee17){return db[_0x7a2d('0x21')]['find'](_['defaults'](_0x4fee17,{'raw':!![],'where':{'id':0x1}}))[_0x7a2d('0x22')](function(_0x44430c){return checkLicense(_0x44430c,null);});};exports[_0x7a2d('0x23')]=checkLicense;