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 _0xbca0=['util','lodash','moment','../../mysqldb','license','License\x20key\x20value\x20not\x20found','data1','data2','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','machineUuid','getUuid','gray','deadline','days','uuid','changed','2027-01-01T00:00:00.000Z','Breaking\x20license','message','Demo\x20license','getLicense','find','crypto'];(function(_0x21e708,_0x1808ea){var _0x2ead69=function(_0x5a657f){while(--_0x5a657f){_0x21e708['push'](_0x21e708['shift']());}};_0x2ead69(++_0x1808ea);}(_0xbca0,0x17f));var _0x0bca=function(_0x504198,_0x417dce){_0x504198=_0x504198-0x0;var _0x23a091=_0xbca0[_0x504198];return _0x23a091;};'use strict';var crypto=require(_0x0bca('0x0'));var util=require(_0x0bca('0x1'));var _=require(_0x0bca('0x2'));var moment=require(_0x0bca('0x3'));var hardware=require('./hardware');var config=require('../environment');var db=require(_0x0bca('0x4'))['db'];function checkLicense(_0x47451a,_0x5be3b4){if(_0x47451a){try{var _0x4a9f79=_0x5be3b4||_0x47451a[_0x0bca('0x5')];if(_['isEmpty'](_0x4a9f79)){throw new Error(_0x0bca('0x6'));}var _0x380958=_0x47451a[_0x0bca('0x7')];var _0x4c2977=_0x47451a[_0x0bca('0x8')];var _0x45b8d2=_0x380958[_0x0bca('0x9')]('-')[0x4];var _0x551a92=_0x380958[_0x0bca('0x9')]('-')[0x0];var _0x7697e8=crypto[_0x0bca('0xa')](_0x0bca('0xb'),util[_0x0bca('0xc')](_0x0bca('0xd'),_0x45b8d2,_0x380958,_0x551a92));var _0x170e90=_0x7697e8[_0x0bca('0xe')](_0x4a9f79,_0x0bca('0xf'),_0x0bca('0x10'));_0x170e90+=_0x7697e8[_0x0bca('0x11')]('utf8');var _0x3bb3fd=JSON[_0x0bca('0x12')](_0x170e90);_0x3bb3fd['demo']=![];_0x3bb3fd['uuid']=_0x380958;_0x3bb3fd[_0x0bca('0x13')]=hardware[_0x0bca('0x14')]();if(_0x4c2977){var _0x2e5d04=crypto[_0x0bca('0xa')](_0x0bca('0xb'),config['secrets']['session']);var _0x101fa9=_0x2e5d04[_0x0bca('0xe')](_0x4c2977,_0x0bca('0xf'),_0x0bca('0x10'));_0x101fa9+=_0x2e5d04['final'](_0x0bca('0x10'));_0x3bb3fd[_0x0bca('0x15')]=_0x101fa9;_0x3bb3fd[_0x0bca('0x16')]=moment(_0x101fa9)['add'](0x7,_0x0bca('0x17'))[_0x0bca('0xc')]();_0x3bb3fd['grayReason']=_0x3bb3fd[_0x0bca('0x18')]!=_0x3bb3fd[_0x0bca('0x13')]?_0x0bca('0x19'):'disabled';}return _0x3bb3fd;}catch(_0x5c1f95){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x0bca('0x1a'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x0bca('0x1b'),'uuid':_0x47451a['data1'],'machineUuid':hardware[_0x0bca('0x14')](),'message':_0x5c1f95[_0x0bca('0x1c')],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x0bca('0x1d'),'uuid':_0x47451a[_0x0bca('0x7')],'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}exports[_0x0bca('0x1e')]=function(_0x16a4c7){return db['License'][_0x0bca('0x1f')](_['defaults'](_0x16a4c7,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x284b5c){return checkLicense(_0x284b5c,null);});};exports['checkLicense']=checkLicense;