Built motion from commit (unavailable).|2.5.4
[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 _0x1ed0=['base64','gray','deadline','days','uuid','disabled','2027-01-01T00:00:00.000Z','Breaking\x20license','message','getLicense','License','find','defaults','then','crypto','util','lodash','./hardware','../environment','../../mysqldb','license','isEmpty','data1','data2','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','utf8','final','demo','machineUuid','getUuid'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1ed0,0x103));var _0x01ed=function(_0x52d7df,_0x5d5742){_0x52d7df=_0x52d7df-0x0;var _0x6163fc=_0x1ed0[_0x52d7df];return _0x6163fc;};'use strict';var crypto=require(_0x01ed('0x0'));var util=require(_0x01ed('0x1'));var _=require(_0x01ed('0x2'));var moment=require('moment');var hardware=require(_0x01ed('0x3'));var config=require(_0x01ed('0x4'));var db=require(_0x01ed('0x5'))['db'];function checkLicense(_0x2ce2ee,_0x52f4dc){if(_0x2ce2ee){try{var _0xbc3fbe=_0x52f4dc||_0x2ce2ee[_0x01ed('0x6')];if(_[_0x01ed('0x7')](_0xbc3fbe)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0xf2ca2c=_0x2ce2ee[_0x01ed('0x8')];var _0x3b5450=_0x2ce2ee[_0x01ed('0x9')];var _0x41f68c=_0xf2ca2c['split']('-')[0x4];var _0x3cd055=_0xf2ca2c[_0x01ed('0xa')]('-')[0x0];var _0x35db8c=crypto[_0x01ed('0xb')](_0x01ed('0xc'),util[_0x01ed('0xd')](_0x01ed('0xe'),_0x41f68c,_0xf2ca2c,_0x3cd055));var _0x56482c=_0x35db8c[_0x01ed('0xf')](_0xbc3fbe,'base64',_0x01ed('0x10'));_0x56482c+=_0x35db8c[_0x01ed('0x11')](_0x01ed('0x10'));var _0x157ad6=JSON['parse'](_0x56482c);_0x157ad6[_0x01ed('0x12')]=![];_0x157ad6['uuid']=_0xf2ca2c;_0x157ad6[_0x01ed('0x13')]=hardware[_0x01ed('0x14')]();if(_0x3b5450){var _0x2762e4=crypto[_0x01ed('0xb')](_0x01ed('0xc'),config['secrets']['session']);var _0xff842f=_0x2762e4['update'](_0x3b5450,_0x01ed('0x15'),_0x01ed('0x10'));_0xff842f+=_0x2762e4[_0x01ed('0x11')]('utf8');_0x157ad6[_0x01ed('0x16')]=_0xff842f;_0x157ad6[_0x01ed('0x17')]=moment(_0xff842f)['add'](0x7,_0x01ed('0x18'))[_0x01ed('0xd')]();_0x157ad6['grayReason']=_0x157ad6[_0x01ed('0x19')]!=_0x157ad6[_0x01ed('0x13')]?'changed':_0x01ed('0x1a');}return _0x157ad6;}catch(_0x174116){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x01ed('0x1b'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x01ed('0x1c'),'uuid':_0x2ce2ee[_0x01ed('0x8')],'machineUuid':hardware[_0x01ed('0x14')](),'message':_0x174116[_0x01ed('0x1d')],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x01ed('0x1b'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','uuid':_0x2ce2ee[_0x01ed('0x8')],'machineUuid':hardware[_0x01ed('0x14')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}exports[_0x01ed('0x1e')]=function(_0x2478a9){return db[_0x01ed('0x1f')][_0x01ed('0x20')](_[_0x01ed('0x21')](_0x2478a9,{'raw':!![],'where':{'id':0x1}}))[_0x01ed('0x22')](function(_0x48e5b4){return checkLicense(_0x48e5b4,null);});};exports['checkLicense']=checkLicense;