Built motion from commit 639a1a7f.|2.6.19
[motion2.git] / server / api / setting / setting.controller.js
index 29fe65c..fa5fad7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf424=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','jayson/promise','client','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','stringify','error','code','Setting,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','set','Content-Range','save','destroy','stack','name','send','index','map','Setting','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','hasOwnProperty','limit','order','sort','where','count','include','findAll','rows','show','params','keys','length','includeAll','options','find','update','body','get','readFileSync','root','server/files/templates/stun.ejs','render','join','server/files/templates/turn.ejs','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','/etc/asterisk/turn_xcally.conf','Reload','res_stun_monitor.so','res_rtp_asterisk.so','addLogo','file','logo','filename','loginLogo','../../config/license/util','getLicense','preferred','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','toLower','default_logo.png','default','upperFirst','custom','\x20not\x20found','download','getLogoLogin','server/files/images/logos','default_loginLogo.png','gdpr','getPreferred','favicon','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','lodash','squel','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x108c5f,_0x505e54){var _0x108ed9=function(_0x30d1ae){while(--_0x30d1ae){_0x108c5f['push'](_0x108c5f['shift']());}};_0x108ed9(++_0x505e54);}(_0xf424,0x15d));var _0x4f42=function(_0x2d4340,_0x14bd7f){_0x2d4340=_0x2d4340-0x0;var _0x5a2e9e=_0xf424[_0x2d4340];return _0x5a2e9e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4f42('0x0'));var rimraf=require(_0x4f42('0x1'));var zipdir=require(_0x4f42('0x2'));var jsonpatch=require(_0x4f42('0x3'));var rp=require('request-promise');var moment=require(_0x4f42('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4f42('0x5'));var util=require('util');var path=require(_0x4f42('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x4f42('0x7'));var squel=require(_0x4f42('0x8'));var crypto=require('crypto');var jsforce=require(_0x4f42('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x4f42('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4f42('0xb'));var authService=require(_0x4f42('0xc'));var qs=require(_0x4f42('0xd'));var as=require(_0x4f42('0xe'));var hardwareService=require(_0x4f42('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0x4f42('0x10'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0x4f42('0x11'));var client=jayson[_0x4f42('0x12')]['http']({'port':0x232a});function checkPasswordPattern(_0x103c65,_0x16d07a,_0xbb2b70){if(_0xbb2b70){var _0x96bd08=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x96bd08['test'](_0x16d07a)){return _0x103c65;}else{throw new db[(_0x4f42('0x13'))][(_0x4f42('0x14'))](_0x4f42('0x15'));}}else{return _0x103c65;}}function respondWithRpcPromise(_0x4c5596,_0x53cf38,_0x337884,_0x1afa15){return new BPromise(function(_0x3a0c81,_0x4ce2d4){var _0x51cf10=_0x1afa15||client;return _0x51cf10[_0x4f42('0x16')](_0x4c5596,_0x337884)[_0x4f42('0x17')](function(_0x2c5696){logger[_0x4f42('0x18')]('Setting,\x20%s,\x20%s',_0x53cf38,_0x4f42('0x19'));logger[_0x4f42('0x1a')]('Setting,\x20%s,\x20%s,\x20%s',_0x53cf38,_0x4f42('0x19'),JSON[_0x4f42('0x1b')](_0x2c5696));if(_0x2c5696[_0x4f42('0x1c')]){if(_0x2c5696[_0x4f42('0x1c')][_0x4f42('0x1d')]===0x1f4){logger['error'](_0x4f42('0x1e'),_0x53cf38,_0x2c5696['error']['message']);return _0x4ce2d4(_0x2c5696[_0x4f42('0x1c')][_0x4f42('0x1f')]);}logger[_0x4f42('0x1c')]('Setting,\x20%s,\x20%s',_0x53cf38,_0x2c5696['error']['message']);return _0x3a0c81(_0x2c5696['error'][_0x4f42('0x1f')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x53cf38,_0x4f42('0x19'));_0x3a0c81(_0x2c5696[_0x4f42('0x20')][_0x4f42('0x1f')]);}})[_0x4f42('0x21')](function(_0x523ae1){logger[_0x4f42('0x1c')](_0x4f42('0x1e'),_0x53cf38,_0x523ae1);_0x4ce2d4(_0x523ae1);});});}function respondWithStatusCode(_0x536392,_0x5d1b1d){_0x5d1b1d=_0x5d1b1d||0xcc;return function(_0x1d2d89){if(_0x1d2d89){return _0x536392[_0x4f42('0x22')](_0x5d1b1d);}return _0x536392[_0x4f42('0x23')](_0x5d1b1d)[_0x4f42('0x24')]();};}function respondWithResult(_0x756ff5,_0x31af0b){_0x31af0b=_0x31af0b||0xc8;return function(_0xd4daf0){if(_0xd4daf0){return _0x756ff5['status'](_0x31af0b)[_0x4f42('0x25')](_0xd4daf0);}};}function respondWithFilteredResult(_0x5b556d,_0x1ef797){return function(_0x18de8f){if(_0x18de8f){var _0x483d01=_0x18de8f['count'],_0x50dc1d=_0x1ef797[_0x4f42('0x26')],_0x2a75ab=_0x1ef797[_0x4f42('0x26')]+_0x1ef797['limit'],_0x5f22c6;if(_0x2a75ab>=_0x483d01){_0x2a75ab=_0x483d01;_0x5f22c6=0xc8;}else{_0x5f22c6=0xce;}_0x5b556d[_0x4f42('0x23')](_0x5f22c6);return _0x5b556d[_0x4f42('0x27')](_0x4f42('0x28'),_0x50dc1d+'-'+_0x2a75ab+'/'+_0x483d01)[_0x4f42('0x25')](_0x18de8f);}return null;};}function patchUpdates(_0xdb3c01){return function(_0x14b5d3){try{jsonpatch['apply'](_0x14b5d3,_0xdb3c01,!![]);}catch(_0x2d832d){return BPromise['reject'](_0x2d832d);}return _0x14b5d3[_0x4f42('0x29')]();};}function saveUpdates(_0x173847,_0x2fd896){return function(_0x23c463){if(_0x23c463){return _0x23c463['update'](_0x173847)[_0x4f42('0x17')](function(_0x2f849a){return _0x2f849a;});}return null;};}function removeEntity(_0x77edb7,_0x50cf0a){return function(_0x1356b4){if(_0x1356b4){return _0x1356b4[_0x4f42('0x2a')]()[_0x4f42('0x17')](function(){_0x77edb7['status'](0xcc)[_0x4f42('0x24')]();});}};}function handleEntityNotFound(_0x284d55,_0x4e0884){return function(_0x5ca6a0){if(!_0x5ca6a0){_0x284d55[_0x4f42('0x22')](0x194);}return _0x5ca6a0;};}function handleError(_0x51dd20,_0x54c545){_0x54c545=_0x54c545||0x1f4;return function(_0x3fbeca){logger[_0x4f42('0x1c')](_0x3fbeca[_0x4f42('0x2b')]);if(_0x3fbeca[_0x4f42('0x2c')]){delete _0x3fbeca[_0x4f42('0x2c')];}_0x51dd20[_0x4f42('0x23')](_0x54c545)[_0x4f42('0x2d')](_0x3fbeca);};}exports[_0x4f42('0x2e')]=function(_0x4a51a0,_0x2c9f2f){var _0x22cca4={},_0x542198={},_0x115ffa={'count':0x0,'rows':[]};var _0x4f2464=_[_0x4f42('0x2f')](db[_0x4f42('0x30')][_0x4f42('0x31')],function(_0x51059e){return{'name':_0x51059e[_0x4f42('0x32')],'type':_0x51059e[_0x4f42('0x33')][_0x4f42('0x34')]};});_0x542198['model']=_[_0x4f42('0x2f')](_0x4f2464,_0x4f42('0x2c'));_0x542198['query']=_['keys'](_0x4a51a0[_0x4f42('0x35')]);_0x542198[_0x4f42('0x36')]=_[_0x4f42('0x37')](_0x542198['model'],_0x542198[_0x4f42('0x35')]);_0x22cca4['attributes']=_[_0x4f42('0x37')](_0x542198[_0x4f42('0x38')],qs[_0x4f42('0x39')](_0x4a51a0[_0x4f42('0x35')]['fields']));_0x22cca4[_0x4f42('0x3a')]=_0x22cca4[_0x4f42('0x3a')]['length']?_0x22cca4[_0x4f42('0x3a')]:_0x542198[_0x4f42('0x38')];if(!_0x4a51a0[_0x4f42('0x35')][_0x4f42('0x3b')]('nolimit')){_0x22cca4['limit']=qs[_0x4f42('0x3c')](_0x4a51a0[_0x4f42('0x35')][_0x4f42('0x3c')]);_0x22cca4['offset']=qs['offset'](_0x4a51a0['query'][_0x4f42('0x26')]);}_0x22cca4[_0x4f42('0x3d')]=qs[_0x4f42('0x3e')](_0x4a51a0[_0x4f42('0x35')][_0x4f42('0x3e')]);_0x22cca4[_0x4f42('0x3f')]=qs['filters'](_['pick'](_0x4a51a0['query'],_0x542198[_0x4f42('0x36')]));if(_0x4a51a0[_0x4f42('0x35')]['filter']){_0x22cca4[_0x4f42('0x3f')]=_['merge'](_0x22cca4[_0x4f42('0x3f')],{'$or':_[_0x4f42('0x2f')](_0x4f2464,function(_0x2d5d51){if(_0x2d5d51[_0x4f42('0x33')]!=='VIRTUAL'){var _0x5a0ce7={};_0x5a0ce7[_0x2d5d51['name']]={'$like':'%'+_0x4a51a0[_0x4f42('0x35')]['filter']+'%'};return _0x5a0ce7;}})});}_0x22cca4=_['merge']({},_0x22cca4,_0x4a51a0['options']);var _0x4e5f75={'where':_0x22cca4['where']};return db[_0x4f42('0x30')][_0x4f42('0x40')](_0x4e5f75)['then'](function(_0x161b12){_0x115ffa[_0x4f42('0x40')]=_0x161b12;if(_0x4a51a0[_0x4f42('0x35')]['includeAll']){_0x22cca4[_0x4f42('0x41')]=[{'all':!![]}];}return db[_0x4f42('0x30')][_0x4f42('0x42')](_0x22cca4);})[_0x4f42('0x17')](function(_0x48c708){_0x115ffa[_0x4f42('0x43')]=_0x48c708;return _0x115ffa;})[_0x4f42('0x17')](respondWithFilteredResult(_0x2c9f2f,_0x22cca4))[_0x4f42('0x21')](handleError(_0x2c9f2f,null));};exports[_0x4f42('0x44')]=function(_0x2cd8be,_0x46ce68){var _0x541532={'raw':![],'where':{'id':_0x2cd8be[_0x4f42('0x45')]['id']}},_0x3553d0={};_0x3553d0[_0x4f42('0x38')]=_[_0x4f42('0x46')](db['Setting'][_0x4f42('0x31')]);_0x3553d0[_0x4f42('0x35')]=_[_0x4f42('0x46')](_0x2cd8be[_0x4f42('0x35')]);_0x3553d0[_0x4f42('0x36')]=_[_0x4f42('0x37')](_0x3553d0[_0x4f42('0x38')],_0x3553d0[_0x4f42('0x35')]);_0x541532[_0x4f42('0x3a')]=_[_0x4f42('0x37')](_0x3553d0['model'],qs[_0x4f42('0x39')](_0x2cd8be[_0x4f42('0x35')]['fields']));_0x541532[_0x4f42('0x3a')]=_0x541532[_0x4f42('0x3a')][_0x4f42('0x47')]?_0x541532['attributes']:_0x3553d0['model'];if(_0x2cd8be['query'][_0x4f42('0x48')]){_0x541532[_0x4f42('0x41')]=[{'all':!![]}];}_0x541532=_['merge']({},_0x541532,_0x2cd8be[_0x4f42('0x49')]);return db[_0x4f42('0x30')][_0x4f42('0x4a')](_0x541532)[_0x4f42('0x17')](handleEntityNotFound(_0x46ce68,null))[_0x4f42('0x17')](respondWithResult(_0x46ce68,null))[_0x4f42('0x21')](handleError(_0x46ce68,null));};exports[_0x4f42('0x4b')]=function(_0x715117,_0xfb8520,_0x4af7e5){var _0x5c5a2e;return db[_0x4f42('0x30')]['find']({'where':{'id':_0x715117[_0x4f42('0x45')]['id']}})[_0x4f42('0x17')](handleEntityNotFound(_0xfb8520,null))['then'](saveUpdates(_0x715117[_0x4f42('0x4c')],null))[_0x4f42('0x17')](function(_0x274820){if(_0x274820){_0x5c5a2e=_0x274820[_0x4f42('0x4d')]({'plain':!![]});var _0x5f2133=fs[_0x4f42('0x4e')](path['join'](config[_0x4f42('0x4f')],_0x4f42('0x50')),'utf8');var _0x57309b=ejs[_0x4f42('0x51')](_0x5f2133,_0x5c5a2e);var _0x1a4927=fs[_0x4f42('0x4e')](path[_0x4f42('0x52')](config[_0x4f42('0x4f')],_0x4f42('0x53')),_0x4f42('0x54'));var _0x5e787e=ejs[_0x4f42('0x51')](_0x1a4927,_0x5c5a2e);fs[_0x4f42('0x55')](_0x4f42('0x56'),_0x57309b);fs[_0x4f42('0x55')](_0x4f42('0x57'),_0x5e787e);return respondWithRpcPromise(_0x4f42('0x58'),_0x4f42('0x4b'),{'module':_0x4f42('0x59')});}})[_0x4f42('0x17')](function(){return respondWithRpcPromise(_0x4f42('0x58'),'update',{'module':_0x4f42('0x5a')});})['then'](function(){return _0x5c5a2e||null;})[_0x4f42('0x17')](respondWithResult(_0xfb8520,null))[_0x4f42('0x21')](handleError(_0xfb8520,null));};exports[_0x4f42('0x5b')]=function(_0x573979,_0x498bfb,_0x4207c0){if(_0x573979[_0x4f42('0x5c')]&&_0x573979[_0x4f42('0x5c')]['filename']){_0x573979[_0x4f42('0x4c')][_0x4f42('0x5d')]=_0x573979[_0x4f42('0x5c')][_0x4f42('0x5e')];}return db['Setting'][_0x4f42('0x4a')]({'where':{'id':_0x573979[_0x4f42('0x45')]['id']}})[_0x4f42('0x17')](handleEntityNotFound(_0x498bfb,null))[_0x4f42('0x17')](saveUpdates(_0x573979[_0x4f42('0x4c')],null))[_0x4f42('0x17')](respondWithResult(_0x498bfb,null))['catch'](handleError(_0x498bfb,null));};exports['addLogoLogin']=function(_0xd46172,_0x32b414,_0x4fbb7c){if(_0xd46172[_0x4f42('0x5c')]&&_0xd46172[_0x4f42('0x5c')][_0x4f42('0x5e')]){_0xd46172[_0x4f42('0x4c')][_0x4f42('0x5f')]=_0xd46172[_0x4f42('0x5c')][_0x4f42('0x5e')];}return db[_0x4f42('0x30')][_0x4f42('0x4a')]({'where':{'id':_0xd46172['params']['id']}})[_0x4f42('0x17')](handleEntityNotFound(_0x32b414,null))['then'](saveUpdates(_0xd46172[_0x4f42('0x4c')],null))[_0x4f42('0x17')](respondWithResult(_0x32b414,null))[_0x4f42('0x21')](handleError(_0x32b414,null));};var utilLicense=require(_0x4f42('0x60'));exports['getLogo']=function(_0x4584f6,_0x5bc08b,_0x255293){var _0x2795c4='server/files/images/logos';var _0x329988={'custom':![]};return utilLicense[_0x4f42('0x61')]()[_0x4f42('0x17')](function(_0x35db60){if(_0x35db60){_0x329988=_0x35db60;}return db[_0x4f42('0x30')]['find']({'where':{'id':_0x4584f6[_0x4f42('0x45')]['id']},'attributes':['logo','loginLogo',_0x4f42('0x62'),'favicon',_0x4f42('0x63'),_0x4f42('0x64'),_0x4f42('0x65'),_0x4f42('0x66')],'raw':!![]});})[_0x4f42('0x17')](handleEntityNotFound(_0x5bc08b,null))['then'](function(_0x1fa3e8){if(_0x1fa3e8){var _0x5e1858=_0x1fa3e8['logo']&&fs[_0x4f42('0x67')](path[_0x4f42('0x52')](config[_0x4f42('0x4f')],_0x2795c4,_['toLower'](_0x1fa3e8['logo'])))?path[_0x4f42('0x52')](config['root'],_0x2795c4,_[_0x4f42('0x68')](_0x1fa3e8[_0x4f42('0x5d')])):path['join'](config['root'],_0x2795c4,_[_0x4f42('0x68')](_0x4f42('0x69')));var _0x46f5fa=_0x4f42('0x6a')+_[_0x4f42('0x6b')](_0x4f42('0x5d'));if(_0x1fa3e8[_0x46f5fa]||!_0x329988[_0x4f42('0x6c')]){_0x5e1858=path[_0x4f42('0x52')](config[_0x4f42('0x4f')],_0x2795c4,_[_0x4f42('0x68')]('default_logo.png'));}if(!fs[_0x4f42('0x67')](_0x5e1858)){throw new db[(_0x4f42('0x13'))][(_0x4f42('0x14'))](_[_0x4f42('0x6b')]('logo')+_0x4f42('0x6d'));}return _0x5bc08b[_0x4f42('0x6e')](_0x5e1858);}})[_0x4f42('0x21')](handleError(_0x5bc08b,null));};var utilLicense=require(_0x4f42('0x60'));exports[_0x4f42('0x6f')]=function(_0x559cbd,_0x58562a,_0x5b1712){var _0x29b2f7=_0x4f42('0x70');var _0x472198={'custom':![]};return utilLicense[_0x4f42('0x61')]()[_0x4f42('0x17')](function(_0x58a0a7){if(_0x58a0a7){_0x472198=_0x58a0a7;}return db[_0x4f42('0x30')][_0x4f42('0x4a')]({'where':{'id':_0x559cbd[_0x4f42('0x45')]['id']},'attributes':[_0x4f42('0x5d'),'loginLogo',_0x4f42('0x62'),'favicon','defaultLogo',_0x4f42('0x64'),_0x4f42('0x65'),'defaultFavicon'],'raw':!![]});})[_0x4f42('0x17')](handleEntityNotFound(_0x58562a,null))[_0x4f42('0x17')](function(_0x447b58){if(_0x447b58){var _0x4ce19a=_0x447b58['loginLogo']&&fs[_0x4f42('0x67')](path[_0x4f42('0x52')](config[_0x4f42('0x4f')],_0x29b2f7,_[_0x4f42('0x68')](_0x447b58[_0x4f42('0x5f')])))?path['join'](config[_0x4f42('0x4f')],_0x29b2f7,_['toLower'](_0x447b58['loginLogo'])):path['join'](config['root'],_0x29b2f7,_[_0x4f42('0x68')](_0x4f42('0x71')));var _0x5d2432=_0x4f42('0x6a')+_['upperFirst'](_0x4f42('0x5f'));if(_0x447b58[_0x5d2432]||!_0x472198['custom']){_0x4ce19a=path[_0x4f42('0x52')](config[_0x4f42('0x4f')],_0x29b2f7,_['toLower'](_0x4f42('0x71')));}if(!fs[_0x4f42('0x67')](_0x4ce19a)){throw new db[(_0x4f42('0x13'))]['ValidationError'](_['upperFirst'](_0x4f42('0x5f'))+_0x4f42('0x6d'));}return _0x58562a['download'](_0x4ce19a);}})['catch'](handleError(_0x58562a,null));};exports[_0x4f42('0x72')]=function(_0x3b55a5,_0x1e6a94){return db[_0x4f42('0x30')]['find']({'where':{'id':_0x3b55a5[_0x4f42('0x45')]['id']},'attributes':['securePassword']})[_0x4f42('0x17')](respondWithResult(_0x1e6a94,null))[_0x4f42('0x21')](handleError(_0x1e6a94,null));};exports['addPreferred']=function(_0x24ef5f,_0xfa42f5,_0x204792){if(_0x24ef5f[_0x4f42('0x5c')]&&_0x24ef5f['file']['filename']){_0x24ef5f['body'][_0x4f42('0x62')]=_0x24ef5f[_0x4f42('0x5c')][_0x4f42('0x5e')];}return db[_0x4f42('0x30')][_0x4f42('0x4a')]({'where':{'id':_0x24ef5f[_0x4f42('0x45')]['id']}})[_0x4f42('0x17')](handleEntityNotFound(_0xfa42f5,null))['then'](saveUpdates(_0x24ef5f[_0x4f42('0x4c')],null))[_0x4f42('0x17')](respondWithResult(_0xfa42f5,null))[_0x4f42('0x21')](handleError(_0xfa42f5,null));};var utilLicense=require(_0x4f42('0x60'));exports[_0x4f42('0x73')]=function(_0x5b5fbc,_0x357944,_0xae8bf4){var _0x28f49d=_0x4f42('0x70');var _0x3fcc27={'custom':![]};return utilLicense[_0x4f42('0x61')]()[_0x4f42('0x17')](function(_0xacf312){if(_0xacf312){_0x3fcc27=_0xacf312;}return db['Setting'][_0x4f42('0x4a')]({'where':{'id':_0x5b5fbc['params']['id']},'attributes':[_0x4f42('0x5d'),_0x4f42('0x5f'),_0x4f42('0x62'),_0x4f42('0x74'),'defaultLogo',_0x4f42('0x64'),_0x4f42('0x65'),_0x4f42('0x66')],'raw':!![]});})['then'](handleEntityNotFound(_0x357944,null))[_0x4f42('0x17')](function(_0x4f6cf8){if(_0x4f6cf8){var _0x37c147=_0x4f6cf8[_0x4f42('0x62')]&&fs[_0x4f42('0x67')](path[_0x4f42('0x52')](config[_0x4f42('0x4f')],_0x28f49d,_['toLower'](_0x4f6cf8[_0x4f42('0x62')])))?path[_0x4f42('0x52')](config[_0x4f42('0x4f')],_0x28f49d,_[_0x4f42('0x68')](_0x4f6cf8[_0x4f42('0x62')])):path['join'](config['root'],_0x28f49d,_[_0x4f42('0x68')](_0x4f42('0x75')));var _0x4570f2=_0x4f42('0x6a')+_[_0x4f42('0x6b')](_0x4f42('0x62'));if(_0x4f6cf8[_0x4570f2]||!_0x3fcc27['custom']||!_0x3fcc27[_0x4f42('0x62')]){_0x37c147=path['join'](config[_0x4f42('0x4f')],_0x28f49d,_[_0x4f42('0x68')]('default_preferred.png'));}if(!fs[_0x4f42('0x67')](_0x37c147)){throw new db['Sequelize'][(_0x4f42('0x14'))](_[_0x4f42('0x6b')]('preferred')+_0x4f42('0x6d'));}return _0x357944['download'](_0x37c147);}})[_0x4f42('0x21')](handleError(_0x357944,null));};exports[_0x4f42('0x76')]=function(_0x1e0022,_0x295a82,_0x4dbb36){if(_0x1e0022['file']&&_0x1e0022['file'][_0x4f42('0x5e')]){_0x1e0022[_0x4f42('0x4c')][_0x4f42('0x74')]=_0x1e0022['file'][_0x4f42('0x5e')];}return db[_0x4f42('0x30')][_0x4f42('0x4a')]({'where':{'id':_0x1e0022['params']['id']}})['then'](handleEntityNotFound(_0x295a82,null))[_0x4f42('0x17')](saveUpdates(_0x1e0022[_0x4f42('0x4c')],null))[_0x4f42('0x17')](respondWithResult(_0x295a82,null))['catch'](handleError(_0x295a82,null));};var utilLicense=require('../../config/license/util');exports[_0x4f42('0x77')]=function(_0x571afe,_0x3805ed,_0x24fa3c){var _0xc5dec9=_0x4f42('0x70');var _0x26ba59={'custom':![]};return utilLicense[_0x4f42('0x61')]()[_0x4f42('0x17')](function(_0x3c1d2e){if(_0x3c1d2e){_0x26ba59=_0x3c1d2e;}return db[_0x4f42('0x30')][_0x4f42('0x4a')]({'where':{'id':_0x571afe['params']['id']},'attributes':[_0x4f42('0x5d'),_0x4f42('0x5f'),_0x4f42('0x62'),_0x4f42('0x74'),_0x4f42('0x63'),'defaultLoginLogo',_0x4f42('0x65'),'defaultFavicon'],'raw':!![]});})[_0x4f42('0x17')](handleEntityNotFound(_0x3805ed,null))[_0x4f42('0x17')](function(_0x519b8d){if(_0x519b8d){var _0x22f40a=_0x519b8d[_0x4f42('0x74')]&&fs[_0x4f42('0x67')](path[_0x4f42('0x52')](config[_0x4f42('0x4f')],_0xc5dec9,_[_0x4f42('0x68')](_0x519b8d[_0x4f42('0x74')])))?path[_0x4f42('0x52')](config[_0x4f42('0x4f')],_0xc5dec9,_[_0x4f42('0x68')](_0x519b8d[_0x4f42('0x74')])):path[_0x4f42('0x52')](config[_0x4f42('0x4f')],_0xc5dec9,_[_0x4f42('0x68')](_0x4f42('0x78')));var _0x4b05bf=_0x4f42('0x6a')+_[_0x4f42('0x6b')]('favicon');if(_0x519b8d[_0x4b05bf]||!_0x26ba59[_0x4f42('0x6c')]){_0x22f40a=path[_0x4f42('0x52')](config[_0x4f42('0x4f')],_0xc5dec9,_['toLower']('default_favicon.ico'));}if(!fs['existsSync'](_0x22f40a)){throw new db[(_0x4f42('0x13'))][(_0x4f42('0x14'))](_[_0x4f42('0x6b')](_0x4f42('0x74'))+_0x4f42('0x6d'));}return _0x3805ed[_0x4f42('0x6e')](_0x22f40a);}})[_0x4f42('0x21')](handleError(_0x3805ed,null));};
\ No newline at end of file
+var _0xb903=['filename','logo','find','addLogoLogin','loginLogo','../../config/license/util','server/files/images/logos','getLicense','preferred','defaultLoginLogo','defaultPreferred','existsSync','join','root','default_logo.svg','default','upperFirst','custom','Sequelize','\x20not\x20found','download','getLogoLogin','defaultLogo','toLower','ValidationError','gdpr','securePassword','addPreferred','getPreferred','favicon','defaultFavicon','default_preferred.png','getFavicon','default_favicon.ico','utcOffset','now','YYYY-MM-DD\x20HH:mm:ss:SSS','send','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','then','info','Setting,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','end','name','Setting','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','map','VIRTUAL','options','include','findAll','rows','params','includeAll','merge','body','addLogo','file'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xb903,0x185));var _0x3b90=function(_0x1d1efa,_0x482cea){_0x1d1efa=_0x1d1efa-0x0;var _0x40d7c9=_0xb903[_0x1d1efa];return _0x40d7c9;};'use strict';var emlformat=require(_0x3b90('0x0'));var rimraf=require(_0x3b90('0x1'));var zipdir=require(_0x3b90('0x2'));var jsonpatch=require(_0x3b90('0x3'));var rp=require('request-promise');var moment=require(_0x3b90('0x4'));var BPromise=require(_0x3b90('0x5'));var Mustache=require(_0x3b90('0x6'));var util=require(_0x3b90('0x7'));var path=require(_0x3b90('0x8'));var sox=require(_0x3b90('0x9'));var csv=require(_0x3b90('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3b90('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3b90('0xc'));var jsforce=require(_0x3b90('0xd'));var deskjs=require(_0x3b90('0xe'));var toCsv=require(_0x3b90('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3b90('0xf'));var logger=require(_0x3b90('0x10'))('api');var utils=require(_0x3b90('0x11'));var config=require(_0x3b90('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x3b90('0x13'))['db'];var jayson=require(_0x3b90('0x14'));var client=jayson[_0x3b90('0x15')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5447df,_0x58c4d1,_0x542cb3,_0x492d39){return new BPromise(function(_0x3a0a55,_0x2c72fb){var _0x4824f9=_0x492d39||client;return _0x4824f9['request'](_0x5447df,_0x542cb3)[_0x3b90('0x16')](function(_0x1b6349){logger[_0x3b90('0x17')](_0x3b90('0x18'),_0x58c4d1,_0x3b90('0x19'));logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0x58c4d1,_0x3b90('0x19'),JSON[_0x3b90('0x1a')](_0x1b6349));if(_0x1b6349['error']){if(_0x1b6349[_0x3b90('0x1b')][_0x3b90('0x1c')]===0x1f4){logger[_0x3b90('0x1b')](_0x3b90('0x18'),_0x58c4d1,_0x1b6349['error'][_0x3b90('0x1d')]);return _0x2c72fb(_0x1b6349['error'][_0x3b90('0x1d')]);}logger[_0x3b90('0x1b')]('Setting,\x20%s,\x20%s',_0x58c4d1,_0x1b6349[_0x3b90('0x1b')][_0x3b90('0x1d')]);return _0x3a0a55(_0x1b6349[_0x3b90('0x1b')][_0x3b90('0x1d')]);}else{logger[_0x3b90('0x17')](_0x3b90('0x18'),_0x58c4d1,_0x3b90('0x19'));_0x3a0a55(_0x1b6349[_0x3b90('0x1e')][_0x3b90('0x1d')]);}})[_0x3b90('0x1f')](function(_0x4e2175){logger[_0x3b90('0x1b')](_0x3b90('0x18'),_0x58c4d1,_0x4e2175);_0x2c72fb(_0x4e2175);});});}function respondWithStatusCode(_0x175b42,_0x7faee){_0x7faee=_0x7faee||0xcc;return function(_0x1227ed){if(_0x1227ed){return _0x175b42[_0x3b90('0x20')](_0x7faee);}return _0x175b42['status'](_0x7faee)['end']();};}function respondWithResult(_0x40955a,_0x29d472){_0x29d472=_0x29d472||0xc8;return function(_0x103324){if(_0x103324){return _0x40955a[_0x3b90('0x21')](_0x29d472)['json'](_0x103324);}};}function respondWithFilteredResult(_0x414462,_0x2936d7){return function(_0x1787d1){if(_0x1787d1){var _0x4caead=typeof _0x2936d7[_0x3b90('0x22')]===_0x3b90('0x23')&&typeof _0x2936d7[_0x3b90('0x24')]===_0x3b90('0x23');var _0x153d7c=_0x1787d1[_0x3b90('0x25')];var _0x4b4d33=_0x4caead?0x0:_0x2936d7[_0x3b90('0x22')];var _0x595ac1=_0x4caead?_0x1787d1[_0x3b90('0x25')]:_0x2936d7[_0x3b90('0x22')]+_0x2936d7[_0x3b90('0x24')];var _0x38eed0;if(_0x595ac1>=_0x153d7c){_0x595ac1=_0x153d7c;_0x38eed0=0xc8;}else{_0x38eed0=0xce;}_0x414462[_0x3b90('0x21')](_0x38eed0);return _0x414462[_0x3b90('0x26')](_0x3b90('0x27'),_0x4b4d33+'-'+_0x595ac1+'/'+_0x153d7c)[_0x3b90('0x28')](_0x1787d1);}return null;};}function patchUpdates(_0x500ceb){return function(_0x4d1f31){try{jsonpatch[_0x3b90('0x29')](_0x4d1f31,_0x500ceb,!![]);}catch(_0x199f73){return BPromise[_0x3b90('0x2a')](_0x199f73);}return _0x4d1f31[_0x3b90('0x2b')]();};}function saveUpdates(_0x522ede,_0x543458){return function(_0xd33ac9){if(_0xd33ac9){return _0xd33ac9[_0x3b90('0x2c')](_0x522ede)[_0x3b90('0x16')](function(_0x4f3ab5){return _0x4f3ab5;});}return null;};}function removeEntity(_0x41bd39,_0x4ca40e){return function(_0x49b4d2){if(_0x49b4d2){return _0x49b4d2[_0x3b90('0x2d')]()[_0x3b90('0x16')](function(){_0x41bd39['status'](0xcc)[_0x3b90('0x2e')]();});}};}function handleEntityNotFound(_0x3d9605,_0x3e30b8){return function(_0x562882){if(!_0x562882){_0x3d9605['sendStatus'](0x194);}return _0x562882;};}function handleError(_0x46c58c,_0x143698){_0x143698=_0x143698||0x1f4;return function(_0x64a5e){logger[_0x3b90('0x1b')](_0x64a5e['stack']);if(_0x64a5e['name']){delete _0x64a5e[_0x3b90('0x2f')];}_0x46c58c[_0x3b90('0x21')](_0x143698)['send'](_0x64a5e);};}exports['index']=function(_0x201712,_0x146bc7){var _0x20416d={},_0x298df6={},_0x5a3266={'count':0x0,'rows':[]};var _0x2154e2=_['map'](db[_0x3b90('0x30')][_0x3b90('0x31')],function(_0x2355bf){return{'name':_0x2355bf[_0x3b90('0x32')],'type':_0x2355bf[_0x3b90('0x33')][_0x3b90('0x34')]};});_0x298df6[_0x3b90('0x35')]=_['map'](_0x2154e2,_0x3b90('0x2f'));_0x298df6[_0x3b90('0x36')]=_[_0x3b90('0x37')](_0x201712[_0x3b90('0x36')]);_0x298df6[_0x3b90('0x38')]=_[_0x3b90('0x39')](_0x298df6[_0x3b90('0x35')],_0x298df6[_0x3b90('0x36')]);_0x20416d[_0x3b90('0x3a')]=_['intersection'](_0x298df6[_0x3b90('0x35')],qs[_0x3b90('0x3b')](_0x201712[_0x3b90('0x36')][_0x3b90('0x3b')]));_0x20416d[_0x3b90('0x3a')]=_0x20416d[_0x3b90('0x3a')][_0x3b90('0x3c')]?_0x20416d[_0x3b90('0x3a')]:_0x298df6[_0x3b90('0x35')];if(!_0x201712[_0x3b90('0x36')][_0x3b90('0x3d')](_0x3b90('0x3e'))){_0x20416d[_0x3b90('0x24')]=qs[_0x3b90('0x24')](_0x201712[_0x3b90('0x36')][_0x3b90('0x24')]);_0x20416d[_0x3b90('0x22')]=qs[_0x3b90('0x22')](_0x201712[_0x3b90('0x36')][_0x3b90('0x22')]);}_0x20416d[_0x3b90('0x3f')]=qs['sort'](_0x201712[_0x3b90('0x36')][_0x3b90('0x40')]);_0x20416d[_0x3b90('0x41')]=qs[_0x3b90('0x38')](_['pick'](_0x201712[_0x3b90('0x36')],_0x298df6['filters']),_0x2154e2);if(_0x201712['query'][_0x3b90('0x42')]){_0x20416d[_0x3b90('0x41')]=_['merge'](_0x20416d[_0x3b90('0x41')],{'$or':_[_0x3b90('0x43')](_0x2154e2,function(_0x2057f5){if(_0x2057f5[_0x3b90('0x33')]!==_0x3b90('0x44')){var _0x3fd5a1={};_0x3fd5a1[_0x2057f5[_0x3b90('0x2f')]]={'$like':'%'+_0x201712[_0x3b90('0x36')][_0x3b90('0x42')]+'%'};return _0x3fd5a1;}})});}_0x20416d=_['merge']({},_0x20416d,_0x201712[_0x3b90('0x45')]);var _0x2e8a90={'where':_0x20416d['where']};return db[_0x3b90('0x30')][_0x3b90('0x25')](_0x2e8a90)[_0x3b90('0x16')](function(_0x1489a2){_0x5a3266[_0x3b90('0x25')]=_0x1489a2;if(_0x201712['query']['includeAll']){_0x20416d[_0x3b90('0x46')]=[{'all':!![]}];}return db['Setting'][_0x3b90('0x47')](_0x20416d);})[_0x3b90('0x16')](function(_0x330002){_0x5a3266[_0x3b90('0x48')]=_0x330002;return _0x5a3266;})[_0x3b90('0x16')](respondWithFilteredResult(_0x146bc7,_0x20416d))['catch'](handleError(_0x146bc7,null));};exports['show']=function(_0x15d262,_0x6bc94a){var _0x9e2ee5={'raw':![],'where':{'id':_0x15d262[_0x3b90('0x49')]['id']}},_0x5d7333={};_0x5d7333[_0x3b90('0x35')]=_[_0x3b90('0x37')](db[_0x3b90('0x30')][_0x3b90('0x31')]);_0x5d7333[_0x3b90('0x36')]=_[_0x3b90('0x37')](_0x15d262[_0x3b90('0x36')]);_0x5d7333[_0x3b90('0x38')]=_['intersection'](_0x5d7333[_0x3b90('0x35')],_0x5d7333[_0x3b90('0x36')]);_0x9e2ee5[_0x3b90('0x3a')]=_['intersection'](_0x5d7333[_0x3b90('0x35')],qs['fields'](_0x15d262[_0x3b90('0x36')][_0x3b90('0x3b')]));_0x9e2ee5[_0x3b90('0x3a')]=_0x9e2ee5['attributes'][_0x3b90('0x3c')]?_0x9e2ee5[_0x3b90('0x3a')]:_0x5d7333['model'];if(_0x15d262['query'][_0x3b90('0x4a')]){_0x9e2ee5[_0x3b90('0x46')]=[{'all':!![]}];}_0x9e2ee5=_[_0x3b90('0x4b')]({},_0x9e2ee5,_0x15d262[_0x3b90('0x45')]);return db['Setting']['find'](_0x9e2ee5)[_0x3b90('0x16')](handleEntityNotFound(_0x6bc94a,null))[_0x3b90('0x16')](respondWithResult(_0x6bc94a,null))[_0x3b90('0x1f')](handleError(_0x6bc94a,null));};exports[_0x3b90('0x2c')]=function(_0x15fe10,_0x4500ed){if(_0x15fe10[_0x3b90('0x4c')]['id']){delete _0x15fe10[_0x3b90('0x4c')]['id'];}return db[_0x3b90('0x30')]['find']({'where':{'id':_0x15fe10[_0x3b90('0x49')]['id']}})[_0x3b90('0x16')](handleEntityNotFound(_0x4500ed,null))['then'](saveUpdates(_0x15fe10[_0x3b90('0x4c')],null))[_0x3b90('0x16')](respondWithResult(_0x4500ed,null))['catch'](handleError(_0x4500ed,null));};exports[_0x3b90('0x4d')]=function(_0x16c30f,_0x115232,_0x1bada9){if(_0x16c30f[_0x3b90('0x4e')]&&_0x16c30f[_0x3b90('0x4e')][_0x3b90('0x4f')]){_0x16c30f['body'][_0x3b90('0x50')]=_0x16c30f[_0x3b90('0x4e')][_0x3b90('0x4f')];}return db[_0x3b90('0x30')][_0x3b90('0x51')]({'where':{'id':_0x16c30f[_0x3b90('0x49')]['id']}})[_0x3b90('0x16')](handleEntityNotFound(_0x115232,null))[_0x3b90('0x16')](saveUpdates(_0x16c30f[_0x3b90('0x4c')],null))[_0x3b90('0x16')](respondWithResult(_0x115232,null))[_0x3b90('0x1f')](handleError(_0x115232,null));};exports[_0x3b90('0x52')]=function(_0x176127,_0x15f741,_0x418e36){if(_0x176127['file']&&_0x176127[_0x3b90('0x4e')]['filename']){_0x176127[_0x3b90('0x4c')][_0x3b90('0x53')]=_0x176127[_0x3b90('0x4e')][_0x3b90('0x4f')];}return db[_0x3b90('0x30')][_0x3b90('0x51')]({'where':{'id':_0x176127['params']['id']}})[_0x3b90('0x16')](handleEntityNotFound(_0x15f741,null))[_0x3b90('0x16')](saveUpdates(_0x176127[_0x3b90('0x4c')],null))[_0x3b90('0x16')](respondWithResult(_0x15f741,null))[_0x3b90('0x1f')](handleError(_0x15f741,null));};var utilLicense=require(_0x3b90('0x54'));exports['getLogo']=function(_0x49f4bd,_0xa8400,_0xb41920){var _0x536da7=_0x3b90('0x55');var _0x3264ed={'custom':![]};return utilLicense[_0x3b90('0x56')]()[_0x3b90('0x16')](function(_0x2a6c0c){if(_0x2a6c0c){_0x3264ed=_0x2a6c0c;}return db[_0x3b90('0x30')][_0x3b90('0x51')]({'where':{'id':_0x49f4bd[_0x3b90('0x49')]['id']},'attributes':[_0x3b90('0x50'),'loginLogo',_0x3b90('0x57'),'favicon','defaultLogo',_0x3b90('0x58'),_0x3b90('0x59'),'defaultFavicon'],'raw':!![]});})[_0x3b90('0x16')](handleEntityNotFound(_0xa8400,null))[_0x3b90('0x16')](function(_0x287be4){if(_0x287be4){var _0x1842f9=_0x287be4[_0x3b90('0x50')]&&fs[_0x3b90('0x5a')](path[_0x3b90('0x5b')](config['root'],_0x536da7,_['toLower'](_0x287be4[_0x3b90('0x50')])))?path['join'](config[_0x3b90('0x5c')],_0x536da7,_['toLower'](_0x287be4[_0x3b90('0x50')])):path['join'](config['root'],_0x536da7,_['toLower'](_0x3b90('0x5d')));var _0x470fe3=_0x3b90('0x5e')+_[_0x3b90('0x5f')](_0x3b90('0x50'));if(_0x287be4[_0x470fe3]||!_0x3264ed[_0x3b90('0x60')]){_0x1842f9=path[_0x3b90('0x5b')](config['root'],_0x536da7,_['toLower']('default_logo.svg'));}if(!fs[_0x3b90('0x5a')](_0x1842f9)){throw new db[(_0x3b90('0x61'))]['ValidationError'](_[_0x3b90('0x5f')](_0x3b90('0x50'))+_0x3b90('0x62'));}return _0xa8400[_0x3b90('0x63')](_0x1842f9);}})[_0x3b90('0x1f')](handleError(_0xa8400,null));};var utilLicense=require(_0x3b90('0x54'));exports[_0x3b90('0x64')]=function(_0x89933c,_0x29548f,_0x5ec095){var _0x41100a='server/files/images/logos';var _0x2bbbac={'custom':![]};return utilLicense[_0x3b90('0x56')]()['then'](function(_0x5b34f5){if(_0x5b34f5){_0x2bbbac=_0x5b34f5;}return db[_0x3b90('0x30')][_0x3b90('0x51')]({'where':{'id':_0x89933c[_0x3b90('0x49')]['id']},'attributes':[_0x3b90('0x50'),_0x3b90('0x53'),_0x3b90('0x57'),'favicon',_0x3b90('0x65'),_0x3b90('0x58'),_0x3b90('0x59'),'defaultFavicon'],'raw':!![]});})[_0x3b90('0x16')](handleEntityNotFound(_0x29548f,null))['then'](function(_0xaec524){if(_0xaec524){var _0x34c02f=_0xaec524[_0x3b90('0x53')]&&fs[_0x3b90('0x5a')](path[_0x3b90('0x5b')](config[_0x3b90('0x5c')],_0x41100a,_['toLower'](_0xaec524[_0x3b90('0x53')])))?path[_0x3b90('0x5b')](config[_0x3b90('0x5c')],_0x41100a,_[_0x3b90('0x66')](_0xaec524[_0x3b90('0x53')])):path[_0x3b90('0x5b')](config[_0x3b90('0x5c')],_0x41100a,_[_0x3b90('0x66')]('default_loginLogo.svg'));var _0x5f6bf9=_0x3b90('0x5e')+_[_0x3b90('0x5f')](_0x3b90('0x53'));if(_0xaec524[_0x5f6bf9]||!_0x2bbbac[_0x3b90('0x60')]){_0x34c02f=path[_0x3b90('0x5b')](config[_0x3b90('0x5c')],_0x41100a,_[_0x3b90('0x66')]('default_loginLogo.svg'));}if(!fs['existsSync'](_0x34c02f)){throw new db[(_0x3b90('0x61'))][(_0x3b90('0x67'))](_[_0x3b90('0x5f')]('loginLogo')+_0x3b90('0x62'));}return _0x29548f['download'](_0x34c02f);}})['catch'](handleError(_0x29548f,null));};exports[_0x3b90('0x68')]=function(_0x300d72,_0x2cfcbf){return db[_0x3b90('0x30')][_0x3b90('0x51')]({'where':{'id':_0x300d72[_0x3b90('0x49')]['id']},'attributes':[_0x3b90('0x69')]})[_0x3b90('0x16')](respondWithResult(_0x2cfcbf,null))[_0x3b90('0x1f')](handleError(_0x2cfcbf,null));};exports[_0x3b90('0x6a')]=function(_0x1c4424,_0x3a0a51,_0x2e621a){if(_0x1c4424[_0x3b90('0x4e')]&&_0x1c4424[_0x3b90('0x4e')]['filename']){_0x1c4424[_0x3b90('0x4c')][_0x3b90('0x57')]=_0x1c4424['file'][_0x3b90('0x4f')];}return db['Setting'][_0x3b90('0x51')]({'where':{'id':_0x1c4424[_0x3b90('0x49')]['id']}})[_0x3b90('0x16')](handleEntityNotFound(_0x3a0a51,null))['then'](saveUpdates(_0x1c4424[_0x3b90('0x4c')],null))[_0x3b90('0x16')](respondWithResult(_0x3a0a51,null))[_0x3b90('0x1f')](handleError(_0x3a0a51,null));};var utilLicense=require(_0x3b90('0x54'));exports[_0x3b90('0x6b')]=function(_0x15befb,_0x4a167d,_0x14cb4c){var _0xc08310=_0x3b90('0x55');var _0x1bd901={'custom':![]};return utilLicense[_0x3b90('0x56')]()['then'](function(_0x5546af){if(_0x5546af){_0x1bd901=_0x5546af;}return db['Setting'][_0x3b90('0x51')]({'where':{'id':_0x15befb[_0x3b90('0x49')]['id']},'attributes':[_0x3b90('0x50'),_0x3b90('0x53'),_0x3b90('0x57'),_0x3b90('0x6c'),_0x3b90('0x65'),_0x3b90('0x58'),_0x3b90('0x59'),_0x3b90('0x6d')],'raw':!![]});})[_0x3b90('0x16')](handleEntityNotFound(_0x4a167d,null))['then'](function(_0x4e3516){if(_0x4e3516){var _0x405f12=_0x4e3516[_0x3b90('0x57')]&&fs[_0x3b90('0x5a')](path[_0x3b90('0x5b')](config[_0x3b90('0x5c')],_0xc08310,_[_0x3b90('0x66')](_0x4e3516[_0x3b90('0x57')])))?path[_0x3b90('0x5b')](config[_0x3b90('0x5c')],_0xc08310,_[_0x3b90('0x66')](_0x4e3516[_0x3b90('0x57')])):path[_0x3b90('0x5b')](config[_0x3b90('0x5c')],_0xc08310,_[_0x3b90('0x66')](_0x3b90('0x6e')));var _0x2790ba=_0x3b90('0x5e')+_[_0x3b90('0x5f')]('preferred');if(_0x4e3516[_0x2790ba]||!_0x1bd901[_0x3b90('0x60')]||!_0x1bd901[_0x3b90('0x57')]){_0x405f12=path[_0x3b90('0x5b')](config[_0x3b90('0x5c')],_0xc08310,_[_0x3b90('0x66')]('default_preferred.png'));}if(!fs[_0x3b90('0x5a')](_0x405f12)){throw new db[(_0x3b90('0x61'))][(_0x3b90('0x67'))](_[_0x3b90('0x5f')](_0x3b90('0x57'))+_0x3b90('0x62'));}return _0x4a167d['download'](_0x405f12);}})[_0x3b90('0x1f')](handleError(_0x4a167d,null));};exports['addFavicon']=function(_0x5ebda5,_0x25b369,_0x29ae3d){if(_0x5ebda5[_0x3b90('0x4e')]&&_0x5ebda5[_0x3b90('0x4e')][_0x3b90('0x4f')]){_0x5ebda5['body'][_0x3b90('0x6c')]=_0x5ebda5[_0x3b90('0x4e')][_0x3b90('0x4f')];}return db[_0x3b90('0x30')][_0x3b90('0x51')]({'where':{'id':_0x5ebda5[_0x3b90('0x49')]['id']}})[_0x3b90('0x16')](handleEntityNotFound(_0x25b369,null))[_0x3b90('0x16')](saveUpdates(_0x5ebda5[_0x3b90('0x4c')],null))[_0x3b90('0x16')](respondWithResult(_0x25b369,null))[_0x3b90('0x1f')](handleError(_0x25b369,null));};var utilLicense=require(_0x3b90('0x54'));exports[_0x3b90('0x6f')]=function(_0x313b07,_0x115aa6,_0x1af0ea){var _0x5f0075=_0x3b90('0x55');var _0x9fcc2={'custom':![]};return utilLicense[_0x3b90('0x56')]()[_0x3b90('0x16')](function(_0x23d3b6){if(_0x23d3b6){_0x9fcc2=_0x23d3b6;}return db[_0x3b90('0x30')]['find']({'where':{'id':_0x313b07[_0x3b90('0x49')]['id']},'attributes':[_0x3b90('0x50'),_0x3b90('0x53'),_0x3b90('0x57'),_0x3b90('0x6c'),'defaultLogo',_0x3b90('0x58'),_0x3b90('0x59'),_0x3b90('0x6d')],'raw':!![]});})[_0x3b90('0x16')](handleEntityNotFound(_0x115aa6,null))['then'](function(_0x52363f){if(_0x52363f){var _0x2b949c=_0x52363f['favicon']&&fs[_0x3b90('0x5a')](path[_0x3b90('0x5b')](config[_0x3b90('0x5c')],_0x5f0075,_[_0x3b90('0x66')](_0x52363f[_0x3b90('0x6c')])))?path['join'](config[_0x3b90('0x5c')],_0x5f0075,_['toLower'](_0x52363f[_0x3b90('0x6c')])):path[_0x3b90('0x5b')](config[_0x3b90('0x5c')],_0x5f0075,_['toLower'](_0x3b90('0x70')));var _0x1ed55e=_0x3b90('0x5e')+_['upperFirst'](_0x3b90('0x6c'));if(_0x52363f[_0x1ed55e]||!_0x9fcc2[_0x3b90('0x60')]){_0x2b949c=path[_0x3b90('0x5b')](config['root'],_0x5f0075,_[_0x3b90('0x66')](_0x3b90('0x70')));}if(!fs[_0x3b90('0x5a')](_0x2b949c)){throw new db[(_0x3b90('0x61'))][(_0x3b90('0x67'))](_[_0x3b90('0x5f')]('favicon')+'\x20not\x20found');}return _0x115aa6['download'](_0x2b949c);}})[_0x3b90('0x1f')](handleError(_0x115aa6,null));};exports['getDate']=function(_0x88a9f3,_0x614c77){var _0x11d805={'offset':moment()[_0x3b90('0x71')]()};_0x11d805[_0x3b90('0x72')]=moment()['utcOffset'](_0x11d805[_0x3b90('0x22')])['format'](_0x3b90('0x73'));return _0x614c77[_0x3b90('0x21')](0xc8)[_0x3b90('0x74')](_0x11d805);};
\ No newline at end of file