Built motion from commit (unavailable).|2.3.1
[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 _0xcec5=['license','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','utf8','parse','uuid','machineUuid','secrets','base64','gray','add','days','changed','disabled','2027-01-01T00:00:00.000Z','Breaking\x20license','message','getUuid','getLicense','License','find','then','checkLicense','crypto','util','lodash','./hardware','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcec5,0xd3));var _0x5cec=function(_0x1fe825,_0x557443){_0x1fe825=_0x1fe825-0x0;var _0x452879=_0xcec5[_0x1fe825];return _0x452879;};'use strict';var crypto=require(_0x5cec('0x0'));var util=require(_0x5cec('0x1'));var _=require(_0x5cec('0x2'));var moment=require('moment');var hardware=require(_0x5cec('0x3'));var config=require('../environment');var db=require(_0x5cec('0x4'))['db'];function checkLicense(_0x43b6e2,_0x386fa5){if(_0x43b6e2){try{var _0x1fb4b4=_0x386fa5||_0x43b6e2[_0x5cec('0x5')];if(_[_0x5cec('0x6')](_0x1fb4b4)){throw new Error(_0x5cec('0x7'));}var _0x284617=_0x43b6e2[_0x5cec('0x8')];var _0x4e0919=_0x43b6e2[_0x5cec('0x9')];var _0x56b32e=_0x284617[_0x5cec('0xa')]('-')[0x4];var _0x568368=_0x284617['split']('-')[0x0];var _0x39bd31=crypto[_0x5cec('0xb')](_0x5cec('0xc'),util[_0x5cec('0xd')](_0x5cec('0xe'),_0x56b32e,_0x284617,_0x568368));var _0x5547ce=_0x39bd31[_0x5cec('0xf')](_0x1fb4b4,'base64',_0x5cec('0x10'));_0x5547ce+=_0x39bd31['final'](_0x5cec('0x10'));var _0x1da5f3=JSON[_0x5cec('0x11')](_0x5547ce);_0x1da5f3['demo']=![];_0x1da5f3[_0x5cec('0x12')]=_0x284617;_0x1da5f3[_0x5cec('0x13')]=hardware['getUuid']();if(_0x4e0919){var _0x207f08=crypto[_0x5cec('0xb')](_0x5cec('0xc'),config[_0x5cec('0x14')]['session']);var _0x4034ea=_0x207f08['update'](_0x4e0919,_0x5cec('0x15'),'utf8');_0x4034ea+=_0x207f08['final'](_0x5cec('0x10'));_0x1da5f3[_0x5cec('0x16')]=_0x4034ea;_0x1da5f3['deadline']=moment(_0x4034ea)[_0x5cec('0x17')](0x7,_0x5cec('0x18'))[_0x5cec('0xd')]();_0x1da5f3['grayReason']=_0x1da5f3['uuid']!=_0x1da5f3['machineUuid']?_0x5cec('0x19'):_0x5cec('0x1a');}return _0x1da5f3;}catch(_0x208260){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x5cec('0x1b'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x5cec('0x1c'),'uuid':_0x43b6e2[_0x5cec('0x8')],'machineUuid':hardware['getUuid'](),'message':_0x208260[_0x5cec('0x1d')],'virtual':0x0,'voice':!![],'preferred':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x5cec('0x1b'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Demo\x20license','uuid':_0x43b6e2['data1'],'machineUuid':hardware[_0x5cec('0x1e')](),'virtual':0x0,'voice':!![],'preferred':![]};}exports[_0x5cec('0x1f')]=function(_0x58068e){return db[_0x5cec('0x20')][_0x5cec('0x21')](_['defaults'](_0x58068e,{'raw':!![],'where':{'id':0x1}}))[_0x5cec('0x22')](function(_0x1ad335){return checkLicense(_0x1ad335,null);});};exports[_0x5cec('0x23')]=checkLicense;