2ca0db7d3e152e051795d2cdca480752422eff90
[motion-next.git] / server / config / utils.js
1 const a888_0x5e37=['chat','voice','isUndefined','Maximum\x20login\x20has\x20been\x20reached','getLicense','includes','toLowerCase','openchannel','User','agents','sms','fax','lodash','mail','getChannels','agent','then','update','clearBlockUser','./license/util','whatsapp','isValidChannel','role','../mysqldb','count'];(function(_0x417cb7,_0x5e37eb){const _0x3f41ee=function(_0x3507ea){while(--_0x3507ea){_0x417cb7['push'](_0x417cb7['shift']());}};_0x3f41ee(++_0x5e37eb);}(a888_0x5e37,0xb1));const a888_0x3f41=function(_0x417cb7,_0x5e37eb){_0x417cb7=_0x417cb7-0x0;let _0x3f41ee=a888_0x5e37[_0x417cb7];return _0x3f41ee;};const _0x56a916=a888_0x3f41;'use strict';const _=require(_0x56a916('0xa')),db=require(_0x56a916('0x15'))['db'],util=require(_0x56a916('0x11')),{Op}=require('sequelize'),channels=[_0x56a916('0x18'),_0x56a916('0xb'),_0x56a916('0x17'),_0x56a916('0x9'),_0x56a916('0x8'),_0x56a916('0x12'),_0x56a916('0x5')];exports[_0x56a916('0xc')]=function(){return channels;},exports[_0x56a916('0x13')]=function(_0x3507ea){const _0xdd6445=_0x56a916;return _0x3507ea=_0x3507ea[_0xdd6445('0x4')](),_[_0xdd6445('0x3')](channels,_0x3507ea);},exports[_0x56a916('0x10')]=function(_0x596a22,_0x9adb9f,_0x30b373,_0x532152){const _0x4315bf=_0x56a916,_0x15b6dd={'loginAttempts':_0x9adb9f,'blocked':_0x30b373};return!_[_0x4315bf('0x0')](_0x532152)&&(_0x15b6dd['blockedAt']=_0x532152),_0x596a22[_0x4315bf('0xf')](_0x15b6dd);},exports[_0x56a916('0x2')]=function(_0x46dc2f){return new Promise(function(_0x4f5b43,_0x498ec2){const _0x34bf23=a888_0x3f41;let _0x17acfa=0x0;_0x46dc2f[_0x34bf23('0x14')]!=='agent'&&_0x4f5b43(_0x46dc2f),db[_0x34bf23('0x6')][_0x34bf23('0x16')]({'where':{'role':_0x34bf23('0xd'),'online':!![],'id':{[Op['ne']]:_0x46dc2f['id']}}})[_0x34bf23('0xe')](function(_0x42b0fe){return _0x17acfa=_0x42b0fe,util['getLicense']();})[_0x34bf23('0xe')](function(_0x5bb07c){const _0x130737=_0x34bf23;if(_0x5bb07c&&_0x5bb07c[_0x130737('0x7')]&&_0x17acfa>=_0x5bb07c[_0x130737('0x7')])throw Error(_0x130737('0x1'));_0x4f5b43(_0x46dc2f);})['catch'](function(_0x1baef3){_0x498ec2(_0x1baef3);});});};