e110243b5c90c19fe94df8d71c8a6bf2a5eeefb6
[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 _0x590b=['demo','machineUuid','getUuid','secrets','session','update','base64','gray','days','grayReason','uuid','changed','disabled','2027-01-01T00:00:00.000Z','Breaking\x20license','message','Demo\x20license','getLicense','find','defaults','crypto','util','lodash','moment','./hardware','../environment','../../mysqldb','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','createDecipher','aes-256-ctr','format','%s:%s:%s','utf8','final','parse'];(function(_0x4c9cd1,_0x13ade9){var _0x3c9a89=function(_0x4ee00a){while(--_0x4ee00a){_0x4c9cd1['push'](_0x4c9cd1['shift']());}};_0x3c9a89(++_0x13ade9);}(_0x590b,0x1cc));var _0xb590=function(_0x597217,_0x4cb26b){_0x597217=_0x597217-0x0;var _0x3f676f=_0x590b[_0x597217];return _0x3f676f;};'use strict';var crypto=require(_0xb590('0x0'));var util=require(_0xb590('0x1'));var _=require(_0xb590('0x2'));var moment=require(_0xb590('0x3'));var hardware=require(_0xb590('0x4'));var config=require(_0xb590('0x5'));var db=require(_0xb590('0x6'))['db'];function checkLicense(_0x379c10,_0x479426){if(_0x379c10){try{var _0x571c25=_0x479426||_0x379c10[_0xb590('0x7')];if(_[_0xb590('0x8')](_0x571c25)){throw new Error(_0xb590('0x9'));}var _0x3bd40e=_0x379c10[_0xb590('0xa')];var _0x25e591=_0x379c10[_0xb590('0xb')];var _0x124fa4=_0x3bd40e[_0xb590('0xc')]('-')[0x4];var _0x47a511=_0x3bd40e[_0xb590('0xc')]('-')[0x0];var _0x4f1525=crypto[_0xb590('0xd')](_0xb590('0xe'),util[_0xb590('0xf')](_0xb590('0x10'),_0x124fa4,_0x3bd40e,_0x47a511));var _0x337c99=_0x4f1525['update'](_0x571c25,'base64',_0xb590('0x11'));_0x337c99+=_0x4f1525[_0xb590('0x12')](_0xb590('0x11'));var _0x457e60=JSON[_0xb590('0x13')](_0x337c99);_0x457e60[_0xb590('0x14')]=![];_0x457e60['uuid']=_0x3bd40e;_0x457e60[_0xb590('0x15')]=hardware[_0xb590('0x16')]();if(_0x25e591){var _0x523858=crypto['createDecipher']('aes-256-ctr',config[_0xb590('0x17')][_0xb590('0x18')]);var _0x338c89=_0x523858[_0xb590('0x19')](_0x25e591,_0xb590('0x1a'),_0xb590('0x11'));_0x338c89+=_0x523858[_0xb590('0x12')](_0xb590('0x11'));_0x457e60[_0xb590('0x1b')]=_0x338c89;_0x457e60['deadline']=moment(_0x338c89)['add'](0x7,_0xb590('0x1c'))[_0xb590('0xf')]();_0x457e60[_0xb590('0x1d')]=_0x457e60[_0xb590('0x1e')]!=_0x457e60[_0xb590('0x15')]?_0xb590('0x1f'):_0xb590('0x20');}return _0x457e60;}catch(_0x489ce8){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xb590('0x21'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xb590('0x22'),'uuid':_0x379c10['data1'],'machineUuid':hardware[_0xb590('0x16')](),'message':_0x489ce8[_0xb590('0x23')],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xb590('0x21'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xb590('0x24'),'uuid':_0x379c10[_0xb590('0xa')],'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}exports[_0xb590('0x25')]=function(_0x713ef1){return db['License'][_0xb590('0x26')](_[_0xb590('0x27')](_0x713ef1,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x4645de){return checkLicense(_0x4645de,null);});};exports['checkLicense']=checkLicense;