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 _0x7b93=['split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','final','demo','uuid','machineUuid','secrets','session','utf8','gray','deadline','add','days','grayReason','disabled','2027-01-01T00:00:00.000Z','Breaking\x20license','data1','getUuid','message','Demo\x20license','getLicense','License','find','defaults','util','lodash','moment','./hardware','../environment','../../mysqldb','isEmpty','License\x20key\x20value\x20not\x20found','data2'];(function(_0x246a29,_0x150d29){var _0x318d7e=function(_0x24aa53){while(--_0x24aa53){_0x246a29['push'](_0x246a29['shift']());}};_0x318d7e(++_0x150d29);}(_0x7b93,0x108));var _0x37b9=function(_0x144f18,_0x39c0ae){_0x144f18=_0x144f18-0x0;var _0x49ef67=_0x7b93[_0x144f18];return _0x49ef67;};'use strict';var crypto=require('crypto');var util=require(_0x37b9('0x0'));var _=require(_0x37b9('0x1'));var moment=require(_0x37b9('0x2'));var hardware=require(_0x37b9('0x3'));var config=require(_0x37b9('0x4'));var db=require(_0x37b9('0x5'))['db'];function checkLicense(_0x6fa12f,_0x629fd5){if(_0x6fa12f){try{var _0x20c50b=_0x629fd5||_0x6fa12f['license'];if(_[_0x37b9('0x6')](_0x20c50b)){throw new Error(_0x37b9('0x7'));}var _0x299bf5=_0x6fa12f['data1'];var _0x2bb829=_0x6fa12f[_0x37b9('0x8')];var _0x2e85be=_0x299bf5['split']('-')[0x4];var _0x501b80=_0x299bf5[_0x37b9('0x9')]('-')[0x0];var _0x56a568=crypto[_0x37b9('0xa')](_0x37b9('0xb'),util[_0x37b9('0xc')](_0x37b9('0xd'),_0x2e85be,_0x299bf5,_0x501b80));var _0x4bf754=_0x56a568[_0x37b9('0xe')](_0x20c50b,_0x37b9('0xf'),'utf8');_0x4bf754+=_0x56a568[_0x37b9('0x10')]('utf8');var _0x3c526e=JSON['parse'](_0x4bf754);_0x3c526e[_0x37b9('0x11')]=![];_0x3c526e[_0x37b9('0x12')]=_0x299bf5;_0x3c526e[_0x37b9('0x13')]=hardware['getUuid']();if(_0x2bb829){var _0xe26ec2=crypto[_0x37b9('0xa')](_0x37b9('0xb'),config[_0x37b9('0x14')][_0x37b9('0x15')]);var _0x167a34=_0xe26ec2[_0x37b9('0xe')](_0x2bb829,_0x37b9('0xf'),'utf8');_0x167a34+=_0xe26ec2[_0x37b9('0x10')](_0x37b9('0x16'));_0x3c526e[_0x37b9('0x17')]=_0x167a34;_0x3c526e[_0x37b9('0x18')]=moment(_0x167a34)[_0x37b9('0x19')](0x7,_0x37b9('0x1a'))['format']();_0x3c526e[_0x37b9('0x1b')]=_0x3c526e[_0x37b9('0x12')]!=_0x3c526e[_0x37b9('0x13')]?'changed':_0x37b9('0x1c');}return _0x3c526e;}catch(_0x194347){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x37b9('0x1d'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x37b9('0x1e'),'uuid':_0x6fa12f[_0x37b9('0x1f')],'machineUuid':hardware[_0x37b9('0x20')](),'message':_0x194347[_0x37b9('0x21')],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x37b9('0x1d'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x37b9('0x22'),'uuid':_0x6fa12f[_0x37b9('0x1f')],'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}exports[_0x37b9('0x23')]=function(_0x1e525c){return db[_0x37b9('0x24')][_0x37b9('0x25')](_[_0x37b9('0x26')](_0x1e525c,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x522d0f){return checkLicense(_0x522d0f,null);});};exports['checkLicense']=checkLicense;