Built motion from commit (unavailable).|2.4.12
[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 _0x11cc=['grayReason','changed','disabled','2027-01-01T00:00:00.000Z','data1','message','Demo\x20license','License','find','defaults','then','checkLicense','crypto','lodash','moment','./hardware','../../mysqldb','license','License\x20key\x20value\x20not\x20found','data2','split','aes-256-ctr','format','%s:%s:%s','base64','utf8','parse','demo','uuid','machineUuid','getUuid','createDecipher','secrets','session','update','gray','deadline','add','days'];(function(_0x272236,_0xde1248){var _0x203136=function(_0x2d8b08){while(--_0x2d8b08){_0x272236['push'](_0x272236['shift']());}};_0x203136(++_0xde1248);}(_0x11cc,0x1e0));var _0xc11c=function(_0x16f77c,_0x5256b1){_0x16f77c=_0x16f77c-0x0;var _0x78986e=_0x11cc[_0x16f77c];return _0x78986e;};'use strict';var crypto=require(_0xc11c('0x0'));var util=require('util');var _=require(_0xc11c('0x1'));var moment=require(_0xc11c('0x2'));var hardware=require(_0xc11c('0x3'));var config=require('../environment');var db=require(_0xc11c('0x4'))['db'];function checkLicense(_0x3677ce,_0x47ba12){if(_0x3677ce){try{var _0x3c3400=_0x47ba12||_0x3677ce[_0xc11c('0x5')];if(_['isEmpty'](_0x3c3400)){throw new Error(_0xc11c('0x6'));}var _0x4e31c5=_0x3677ce['data1'];var _0x195e81=_0x3677ce[_0xc11c('0x7')];var _0x4de5b3=_0x4e31c5['split']('-')[0x4];var _0x23739b=_0x4e31c5[_0xc11c('0x8')]('-')[0x0];var _0x49255f=crypto['createDecipher'](_0xc11c('0x9'),util[_0xc11c('0xa')](_0xc11c('0xb'),_0x4de5b3,_0x4e31c5,_0x23739b));var _0x55d04a=_0x49255f['update'](_0x3c3400,_0xc11c('0xc'),_0xc11c('0xd'));_0x55d04a+=_0x49255f['final'](_0xc11c('0xd'));var _0x5c2122=JSON[_0xc11c('0xe')](_0x55d04a);_0x5c2122[_0xc11c('0xf')]=![];_0x5c2122[_0xc11c('0x10')]=_0x4e31c5;_0x5c2122[_0xc11c('0x11')]=hardware[_0xc11c('0x12')]();if(_0x195e81){var _0x2b6683=crypto[_0xc11c('0x13')](_0xc11c('0x9'),config[_0xc11c('0x14')][_0xc11c('0x15')]);var _0x1dfee2=_0x2b6683[_0xc11c('0x16')](_0x195e81,'base64',_0xc11c('0xd'));_0x1dfee2+=_0x2b6683['final']('utf8');_0x5c2122[_0xc11c('0x17')]=_0x1dfee2;_0x5c2122[_0xc11c('0x18')]=moment(_0x1dfee2)[_0xc11c('0x19')](0x7,_0xc11c('0x1a'))[_0xc11c('0xa')]();_0x5c2122[_0xc11c('0x1b')]=_0x5c2122['uuid']!=_0x5c2122['machineUuid']?_0xc11c('0x1c'):_0xc11c('0x1d');}return _0x5c2122;}catch(_0xfd4975){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xc11c('0x1e'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','uuid':_0x3677ce[_0xc11c('0x1f')],'machineUuid':hardware['getUuid'](),'message':_0xfd4975[_0xc11c('0x20')],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xc11c('0x1e'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xc11c('0x21'),'uuid':_0x3677ce[_0xc11c('0x1f')],'machineUuid':hardware[_0xc11c('0x12')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![]};}exports['getLicense']=function(_0x1bb3e9){return db[_0xc11c('0x22')][_0xc11c('0x23')](_[_0xc11c('0x24')](_0x1bb3e9,{'raw':!![],'where':{'id':0x1}}))[_0xc11c('0x25')](function(_0x3dfa9c){return checkLicense(_0x3dfa9c,null);});};exports[_0xc11c('0x26')]=checkLicense;