Built motion from commit (unavailable).|2.5.17
[motion2.git] / server / api / setting / setting.controller.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 _0x3bff=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','result','status','end','json','count','offset','limit','set','Content-Range','reject','save','destroy','sendStatus','name','send','index','Setting','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','length','options','find','catch','update','body','file','filename','logo','addLogoLogin','loginLogo','getLogo','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','root','join','toLower','default_logo.svg','default','upperFirst','\x20not\x20found','getLogoLogin','server/files/images/logos','default_loginLogo.svg','custom','ValidationError','download','gdpr','addPreferred','default_preferred.png','Sequelize','getFavicon','default_favicon.ico','utcOffset','now','format','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse'];(function(_0x7ac8af,_0x500e3e){var _0x413be8=function(_0x3f939e){while(--_0x3f939e){_0x7ac8af['push'](_0x7ac8af['shift']());}};_0x413be8(++_0x500e3e);}(_0x3bff,0x1dc));var _0xf3bf=function(_0x5cfb92,_0x5797e6){_0x5cfb92=_0x5cfb92-0x0;var _0x1cd7c2=_0x3bff[_0x5cfb92];return _0x1cd7c2;};'use strict';var pdf=require(_0xf3bf('0x0'));var emlformat=require(_0xf3bf('0x1'));var rimraf=require(_0xf3bf('0x2'));var zipdir=require(_0xf3bf('0x3'));var jsonpatch=require(_0xf3bf('0x4'));var rp=require('request-promise');var moment=require(_0xf3bf('0x5'));var BPromise=require(_0xf3bf('0x6'));var Mustache=require(_0xf3bf('0x7'));var util=require(_0xf3bf('0x8'));var path=require(_0xf3bf('0x9'));var sox=require(_0xf3bf('0xa'));var csv=require('to-csv');var ejs=require(_0xf3bf('0xb'));var fs=require('fs');var _=require(_0xf3bf('0xc'));var squel=require(_0xf3bf('0xd'));var crypto=require(_0xf3bf('0xe'));var jsforce=require(_0xf3bf('0xf'));var deskjs=require(_0xf3bf('0x10'));var toCsv=require(_0xf3bf('0x11'));var querystring=require(_0xf3bf('0x12'));var Papa=require(_0xf3bf('0x13'));var Redis=require(_0xf3bf('0x14'));var authService=require(_0xf3bf('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0xf3bf('0x16'));var hardwareService=require(_0xf3bf('0x17'));var logger=require(_0xf3bf('0x18'))(_0xf3bf('0x19'));var utils=require('../../config/utils');var config=require(_0xf3bf('0x1a'));var licenseUtil=require(_0xf3bf('0x1b'));var db=require(_0xf3bf('0x1c'))['db'];var jayson=require(_0xf3bf('0x1d'));var client=jayson['client'][_0xf3bf('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x5a665d,_0x2108d8,_0xfc0404,_0x386543){return new BPromise(function(_0x52baad,_0x5280aa){var _0x1d3d1f=_0x386543||client;return _0x1d3d1f[_0xf3bf('0x1f')](_0x5a665d,_0xfc0404)[_0xf3bf('0x20')](function(_0x52b6d9){logger[_0xf3bf('0x21')](_0xf3bf('0x22'),_0x2108d8,_0xf3bf('0x23'));logger['debug'](_0xf3bf('0x24'),_0x2108d8,_0xf3bf('0x23'),JSON[_0xf3bf('0x25')](_0x52b6d9));if(_0x52b6d9[_0xf3bf('0x26')]){if(_0x52b6d9[_0xf3bf('0x26')]['code']===0x1f4){logger[_0xf3bf('0x26')](_0xf3bf('0x22'),_0x2108d8,_0x52b6d9['error'][_0xf3bf('0x27')]);return _0x5280aa(_0x52b6d9['error'][_0xf3bf('0x27')]);}logger[_0xf3bf('0x26')](_0xf3bf('0x22'),_0x2108d8,_0x52b6d9[_0xf3bf('0x26')][_0xf3bf('0x27')]);return _0x52baad(_0x52b6d9[_0xf3bf('0x26')]['message']);}else{logger[_0xf3bf('0x21')](_0xf3bf('0x22'),_0x2108d8,_0xf3bf('0x23'));_0x52baad(_0x52b6d9[_0xf3bf('0x28')]['message']);}})['catch'](function(_0x4ac404){logger[_0xf3bf('0x26')](_0xf3bf('0x22'),_0x2108d8,_0x4ac404);_0x5280aa(_0x4ac404);});});}function respondWithStatusCode(_0x4fa7f6,_0x46b6a0){_0x46b6a0=_0x46b6a0||0xcc;return function(_0x2242c9){if(_0x2242c9){return _0x4fa7f6['sendStatus'](_0x46b6a0);}return _0x4fa7f6[_0xf3bf('0x29')](_0x46b6a0)[_0xf3bf('0x2a')]();};}function respondWithResult(_0xf3d320,_0x1930c5){_0x1930c5=_0x1930c5||0xc8;return function(_0x36de13){if(_0x36de13){return _0xf3d320[_0xf3bf('0x29')](_0x1930c5)[_0xf3bf('0x2b')](_0x36de13);}};}function respondWithFilteredResult(_0x23ef70,_0x1caa14){return function(_0x4e4e45){if(_0x4e4e45){var _0xc66a4d=_0x4e4e45[_0xf3bf('0x2c')],_0x3beae3=_0x1caa14['offset'],_0x7e9c5d=_0x1caa14[_0xf3bf('0x2d')]+_0x1caa14[_0xf3bf('0x2e')],_0x3922f8;if(_0x7e9c5d>=_0xc66a4d){_0x7e9c5d=_0xc66a4d;_0x3922f8=0xc8;}else{_0x3922f8=0xce;}_0x23ef70[_0xf3bf('0x29')](_0x3922f8);return _0x23ef70[_0xf3bf('0x2f')](_0xf3bf('0x30'),_0x3beae3+'-'+_0x7e9c5d+'/'+_0xc66a4d)[_0xf3bf('0x2b')](_0x4e4e45);}return null;};}function patchUpdates(_0x478c4b){return function(_0x54901c){try{jsonpatch['apply'](_0x54901c,_0x478c4b,!![]);}catch(_0xb23ce0){return BPromise[_0xf3bf('0x31')](_0xb23ce0);}return _0x54901c[_0xf3bf('0x32')]();};}function saveUpdates(_0x4418cb,_0x105181){return function(_0x4d1d3b){if(_0x4d1d3b){return _0x4d1d3b['update'](_0x4418cb)['then'](function(_0xfcf276){return _0xfcf276;});}return null;};}function removeEntity(_0x317bb9,_0x29c70b){return function(_0x43d363){if(_0x43d363){return _0x43d363[_0xf3bf('0x33')]()[_0xf3bf('0x20')](function(){_0x317bb9['status'](0xcc)[_0xf3bf('0x2a')]();});}};}function handleEntityNotFound(_0x1cea10,_0x76ba01){return function(_0x3af8eb){if(!_0x3af8eb){_0x1cea10[_0xf3bf('0x34')](0x194);}return _0x3af8eb;};}function handleError(_0x9b2ff9,_0xd86d55){_0xd86d55=_0xd86d55||0x1f4;return function(_0x12653d){logger['error'](_0x12653d['stack']);if(_0x12653d['name']){delete _0x12653d[_0xf3bf('0x35')];}_0x9b2ff9[_0xf3bf('0x29')](_0xd86d55)[_0xf3bf('0x36')](_0x12653d);};}exports[_0xf3bf('0x37')]=function(_0x3c026b,_0x319c9e){var _0x28f332={},_0x3cf9cc={},_0x5b71b6={'count':0x0,'rows':[]};var _0x284263=_['map'](db[_0xf3bf('0x38')][_0xf3bf('0x39')],function(_0x1e5520){return{'name':_0x1e5520[_0xf3bf('0x3a')],'type':_0x1e5520[_0xf3bf('0x3b')][_0xf3bf('0x3c')]};});_0x3cf9cc['model']=_[_0xf3bf('0x3d')](_0x284263,_0xf3bf('0x35'));_0x3cf9cc[_0xf3bf('0x3e')]=_[_0xf3bf('0x3f')](_0x3c026b[_0xf3bf('0x3e')]);_0x3cf9cc[_0xf3bf('0x40')]=_[_0xf3bf('0x41')](_0x3cf9cc[_0xf3bf('0x42')],_0x3cf9cc['query']);_0x28f332[_0xf3bf('0x43')]=_[_0xf3bf('0x41')](_0x3cf9cc[_0xf3bf('0x42')],qs[_0xf3bf('0x44')](_0x3c026b[_0xf3bf('0x3e')][_0xf3bf('0x44')]));_0x28f332['attributes']=_0x28f332[_0xf3bf('0x43')]['length']?_0x28f332[_0xf3bf('0x43')]:_0x3cf9cc[_0xf3bf('0x42')];if(!_0x3c026b[_0xf3bf('0x3e')]['hasOwnProperty'](_0xf3bf('0x45'))){_0x28f332[_0xf3bf('0x2e')]=qs[_0xf3bf('0x2e')](_0x3c026b[_0xf3bf('0x3e')][_0xf3bf('0x2e')]);_0x28f332[_0xf3bf('0x2d')]=qs[_0xf3bf('0x2d')](_0x3c026b['query'][_0xf3bf('0x2d')]);}_0x28f332['order']=qs['sort'](_0x3c026b['query'][_0xf3bf('0x46')]);_0x28f332[_0xf3bf('0x47')]=qs[_0xf3bf('0x40')](_[_0xf3bf('0x48')](_0x3c026b['query'],_0x3cf9cc[_0xf3bf('0x40')]),_0x284263);if(_0x3c026b['query'][_0xf3bf('0x49')]){_0x28f332[_0xf3bf('0x47')]=_[_0xf3bf('0x4a')](_0x28f332[_0xf3bf('0x47')],{'$or':_['map'](_0x284263,function(_0x5e283a){if(_0x5e283a[_0xf3bf('0x3b')]!==_0xf3bf('0x4b')){var _0x4f0c4e={};_0x4f0c4e[_0x5e283a[_0xf3bf('0x35')]]={'$like':'%'+_0x3c026b[_0xf3bf('0x3e')][_0xf3bf('0x49')]+'%'};return _0x4f0c4e;}})});}_0x28f332=_[_0xf3bf('0x4a')]({},_0x28f332,_0x3c026b['options']);var _0x2705f9={'where':_0x28f332[_0xf3bf('0x47')]};return db[_0xf3bf('0x38')]['count'](_0x2705f9)[_0xf3bf('0x20')](function(_0x26fd5){_0x5b71b6[_0xf3bf('0x2c')]=_0x26fd5;if(_0x3c026b['query'][_0xf3bf('0x4c')]){_0x28f332[_0xf3bf('0x4d')]=[{'all':!![]}];}return db[_0xf3bf('0x38')][_0xf3bf('0x4e')](_0x28f332);})[_0xf3bf('0x20')](function(_0x3be68d){_0x5b71b6[_0xf3bf('0x4f')]=_0x3be68d;return _0x5b71b6;})[_0xf3bf('0x20')](respondWithFilteredResult(_0x319c9e,_0x28f332))['catch'](handleError(_0x319c9e,null));};exports[_0xf3bf('0x50')]=function(_0x55ee41,_0x1522b3){var _0x1822e7={'raw':![],'where':{'id':_0x55ee41[_0xf3bf('0x51')]['id']}},_0x3d0ac0={};_0x3d0ac0[_0xf3bf('0x42')]=_['keys'](db[_0xf3bf('0x38')][_0xf3bf('0x39')]);_0x3d0ac0[_0xf3bf('0x3e')]=_[_0xf3bf('0x3f')](_0x55ee41[_0xf3bf('0x3e')]);_0x3d0ac0[_0xf3bf('0x40')]=_[_0xf3bf('0x41')](_0x3d0ac0[_0xf3bf('0x42')],_0x3d0ac0[_0xf3bf('0x3e')]);_0x1822e7['attributes']=_['intersection'](_0x3d0ac0['model'],qs[_0xf3bf('0x44')](_0x55ee41['query'][_0xf3bf('0x44')]));_0x1822e7[_0xf3bf('0x43')]=_0x1822e7[_0xf3bf('0x43')][_0xf3bf('0x52')]?_0x1822e7[_0xf3bf('0x43')]:_0x3d0ac0['model'];if(_0x55ee41[_0xf3bf('0x3e')]['includeAll']){_0x1822e7[_0xf3bf('0x4d')]=[{'all':!![]}];}_0x1822e7=_['merge']({},_0x1822e7,_0x55ee41[_0xf3bf('0x53')]);return db[_0xf3bf('0x38')][_0xf3bf('0x54')](_0x1822e7)['then'](handleEntityNotFound(_0x1522b3,null))[_0xf3bf('0x20')](respondWithResult(_0x1522b3,null))[_0xf3bf('0x55')](handleError(_0x1522b3,null));};exports[_0xf3bf('0x56')]=function(_0x28590c,_0x54963e){if(_0x28590c['body']['id']){delete _0x28590c[_0xf3bf('0x57')]['id'];}return db[_0xf3bf('0x38')][_0xf3bf('0x54')]({'where':{'id':_0x28590c[_0xf3bf('0x51')]['id']}})[_0xf3bf('0x20')](handleEntityNotFound(_0x54963e,null))[_0xf3bf('0x20')](saveUpdates(_0x28590c['body'],null))[_0xf3bf('0x20')](respondWithResult(_0x54963e,null))[_0xf3bf('0x55')](handleError(_0x54963e,null));};exports['addLogo']=function(_0x456497,_0x436c3d,_0x498011){if(_0x456497[_0xf3bf('0x58')]&&_0x456497['file'][_0xf3bf('0x59')]){_0x456497[_0xf3bf('0x57')][_0xf3bf('0x5a')]=_0x456497[_0xf3bf('0x58')][_0xf3bf('0x59')];}return db['Setting'][_0xf3bf('0x54')]({'where':{'id':_0x456497[_0xf3bf('0x51')]['id']}})[_0xf3bf('0x20')](handleEntityNotFound(_0x436c3d,null))['then'](saveUpdates(_0x456497[_0xf3bf('0x57')],null))[_0xf3bf('0x20')](respondWithResult(_0x436c3d,null))[_0xf3bf('0x55')](handleError(_0x436c3d,null));};exports[_0xf3bf('0x5b')]=function(_0x5e9ab7,_0x385e26,_0x3c5564){if(_0x5e9ab7[_0xf3bf('0x58')]&&_0x5e9ab7[_0xf3bf('0x58')][_0xf3bf('0x59')]){_0x5e9ab7[_0xf3bf('0x57')][_0xf3bf('0x5c')]=_0x5e9ab7[_0xf3bf('0x58')][_0xf3bf('0x59')];}return db[_0xf3bf('0x38')][_0xf3bf('0x54')]({'where':{'id':_0x5e9ab7[_0xf3bf('0x51')]['id']}})[_0xf3bf('0x20')](handleEntityNotFound(_0x385e26,null))[_0xf3bf('0x20')](saveUpdates(_0x5e9ab7[_0xf3bf('0x57')],null))[_0xf3bf('0x20')](respondWithResult(_0x385e26,null))[_0xf3bf('0x55')](handleError(_0x385e26,null));};var utilLicense=require(_0xf3bf('0x1b'));exports[_0xf3bf('0x5d')]=function(_0x4bd18f,_0x14a5df,_0x4fc0fc){var _0x5a7831='server/files/images/logos';var _0x4da360={'custom':![]};return utilLicense[_0xf3bf('0x5e')]()[_0xf3bf('0x20')](function(_0xe27773){if(_0xe27773){_0x4da360=_0xe27773;}return db[_0xf3bf('0x38')][_0xf3bf('0x54')]({'where':{'id':_0x4bd18f['params']['id']},'attributes':[_0xf3bf('0x5a'),_0xf3bf('0x5c'),_0xf3bf('0x5f'),_0xf3bf('0x60'),_0xf3bf('0x61'),_0xf3bf('0x62'),_0xf3bf('0x63'),_0xf3bf('0x64')],'raw':!![]});})[_0xf3bf('0x20')](handleEntityNotFound(_0x14a5df,null))[_0xf3bf('0x20')](function(_0x41fa9b){if(_0x41fa9b){var _0x4d6ef0=_0x41fa9b[_0xf3bf('0x5a')]&&fs[_0xf3bf('0x65')](path['join'](config[_0xf3bf('0x66')],_0x5a7831,_['toLower'](_0x41fa9b[_0xf3bf('0x5a')])))?path[_0xf3bf('0x67')](config['root'],_0x5a7831,_[_0xf3bf('0x68')](_0x41fa9b['logo'])):path[_0xf3bf('0x67')](config[_0xf3bf('0x66')],_0x5a7831,_[_0xf3bf('0x68')](_0xf3bf('0x69')));var _0x1fb257=_0xf3bf('0x6a')+_[_0xf3bf('0x6b')](_0xf3bf('0x5a'));if(_0x41fa9b[_0x1fb257]||!_0x4da360['custom']){_0x4d6ef0=path[_0xf3bf('0x67')](config[_0xf3bf('0x66')],_0x5a7831,_[_0xf3bf('0x68')](_0xf3bf('0x69')));}if(!fs[_0xf3bf('0x65')](_0x4d6ef0)){throw new db['Sequelize']['ValidationError'](_[_0xf3bf('0x6b')]('logo')+_0xf3bf('0x6c'));}return _0x14a5df['download'](_0x4d6ef0);}})[_0xf3bf('0x55')](handleError(_0x14a5df,null));};var utilLicense=require(_0xf3bf('0x1b'));exports[_0xf3bf('0x6d')]=function(_0x421fd0,_0x3f739e,_0x218540){var _0x540f69=_0xf3bf('0x6e');var _0x3005aa={'custom':![]};return utilLicense[_0xf3bf('0x5e')]()[_0xf3bf('0x20')](function(_0x248d41){if(_0x248d41){_0x3005aa=_0x248d41;}return db[_0xf3bf('0x38')][_0xf3bf('0x54')]({'where':{'id':_0x421fd0[_0xf3bf('0x51')]['id']},'attributes':[_0xf3bf('0x5a'),_0xf3bf('0x5c'),_0xf3bf('0x5f'),_0xf3bf('0x60'),'defaultLogo','defaultLoginLogo',_0xf3bf('0x63'),_0xf3bf('0x64')],'raw':!![]});})[_0xf3bf('0x20')](handleEntityNotFound(_0x3f739e,null))[_0xf3bf('0x20')](function(_0x2eca65){if(_0x2eca65){var _0x26ef71=_0x2eca65[_0xf3bf('0x5c')]&&fs[_0xf3bf('0x65')](path[_0xf3bf('0x67')](config[_0xf3bf('0x66')],_0x540f69,_['toLower'](_0x2eca65[_0xf3bf('0x5c')])))?path[_0xf3bf('0x67')](config[_0xf3bf('0x66')],_0x540f69,_[_0xf3bf('0x68')](_0x2eca65[_0xf3bf('0x5c')])):path[_0xf3bf('0x67')](config[_0xf3bf('0x66')],_0x540f69,_[_0xf3bf('0x68')](_0xf3bf('0x6f')));var _0x4186cb=_0xf3bf('0x6a')+_[_0xf3bf('0x6b')](_0xf3bf('0x5c'));if(_0x2eca65[_0x4186cb]||!_0x3005aa[_0xf3bf('0x70')]){_0x26ef71=path[_0xf3bf('0x67')](config[_0xf3bf('0x66')],_0x540f69,_[_0xf3bf('0x68')](_0xf3bf('0x6f')));}if(!fs[_0xf3bf('0x65')](_0x26ef71)){throw new db['Sequelize'][(_0xf3bf('0x71'))](_['upperFirst'](_0xf3bf('0x5c'))+'\x20not\x20found');}return _0x3f739e[_0xf3bf('0x72')](_0x26ef71);}})[_0xf3bf('0x55')](handleError(_0x3f739e,null));};exports[_0xf3bf('0x73')]=function(_0x4d2585,_0x1fada7){return db[_0xf3bf('0x38')][_0xf3bf('0x54')]({'where':{'id':_0x4d2585[_0xf3bf('0x51')]['id']},'attributes':['securePassword']})[_0xf3bf('0x20')](respondWithResult(_0x1fada7,null))['catch'](handleError(_0x1fada7,null));};exports[_0xf3bf('0x74')]=function(_0x45b356,_0x329d5d,_0x40a505){if(_0x45b356[_0xf3bf('0x58')]&&_0x45b356[_0xf3bf('0x58')][_0xf3bf('0x59')]){_0x45b356[_0xf3bf('0x57')][_0xf3bf('0x5f')]=_0x45b356[_0xf3bf('0x58')][_0xf3bf('0x59')];}return db[_0xf3bf('0x38')][_0xf3bf('0x54')]({'where':{'id':_0x45b356[_0xf3bf('0x51')]['id']}})['then'](handleEntityNotFound(_0x329d5d,null))[_0xf3bf('0x20')](saveUpdates(_0x45b356[_0xf3bf('0x57')],null))['then'](respondWithResult(_0x329d5d,null))[_0xf3bf('0x55')](handleError(_0x329d5d,null));};var utilLicense=require(_0xf3bf('0x1b'));exports['getPreferred']=function(_0x284a69,_0x3a92bd,_0x436625){var _0x330a0e=_0xf3bf('0x6e');var _0x53107e={'custom':![]};return utilLicense[_0xf3bf('0x5e')]()[_0xf3bf('0x20')](function(_0x4410d3){if(_0x4410d3){_0x53107e=_0x4410d3;}return db['Setting']['find']({'where':{'id':_0x284a69['params']['id']},'attributes':[_0xf3bf('0x5a'),_0xf3bf('0x5c'),_0xf3bf('0x5f'),_0xf3bf('0x60'),_0xf3bf('0x61'),_0xf3bf('0x62'),_0xf3bf('0x63'),_0xf3bf('0x64')],'raw':!![]});})[_0xf3bf('0x20')](handleEntityNotFound(_0x3a92bd,null))[_0xf3bf('0x20')](function(_0x43a71f){if(_0x43a71f){var _0x20f422=_0x43a71f[_0xf3bf('0x5f')]&&fs[_0xf3bf('0x65')](path[_0xf3bf('0x67')](config['root'],_0x330a0e,_[_0xf3bf('0x68')](_0x43a71f[_0xf3bf('0x5f')])))?path['join'](config[_0xf3bf('0x66')],_0x330a0e,_['toLower'](_0x43a71f[_0xf3bf('0x5f')])):path[_0xf3bf('0x67')](config[_0xf3bf('0x66')],_0x330a0e,_[_0xf3bf('0x68')](_0xf3bf('0x75')));var _0x2cd1cd='default'+_[_0xf3bf('0x6b')]('preferred');if(_0x43a71f[_0x2cd1cd]||!_0x53107e[_0xf3bf('0x70')]||!_0x53107e['preferred']){_0x20f422=path[_0xf3bf('0x67')](config[_0xf3bf('0x66')],_0x330a0e,_['toLower']('default_preferred.png'));}if(!fs[_0xf3bf('0x65')](_0x20f422)){throw new db[(_0xf3bf('0x76'))][(_0xf3bf('0x71'))](_[_0xf3bf('0x6b')](_0xf3bf('0x5f'))+_0xf3bf('0x6c'));}return _0x3a92bd['download'](_0x20f422);}})[_0xf3bf('0x55')](handleError(_0x3a92bd,null));};exports['addFavicon']=function(_0x4b4f67,_0x2b1374,_0x19f56f){if(_0x4b4f67[_0xf3bf('0x58')]&&_0x4b4f67[_0xf3bf('0x58')]['filename']){_0x4b4f67[_0xf3bf('0x57')]['favicon']=_0x4b4f67[_0xf3bf('0x58')][_0xf3bf('0x59')];}return db[_0xf3bf('0x38')][_0xf3bf('0x54')]({'where':{'id':_0x4b4f67[_0xf3bf('0x51')]['id']}})[_0xf3bf('0x20')](handleEntityNotFound(_0x2b1374,null))[_0xf3bf('0x20')](saveUpdates(_0x4b4f67[_0xf3bf('0x57')],null))[_0xf3bf('0x20')](respondWithResult(_0x2b1374,null))[_0xf3bf('0x55')](handleError(_0x2b1374,null));};var utilLicense=require(_0xf3bf('0x1b'));exports[_0xf3bf('0x77')]=function(_0x2f499f,_0x4b5fd7,_0x5d06f6){var _0x3697d1='server/files/images/logos';var _0x6e7289={'custom':![]};return utilLicense[_0xf3bf('0x5e')]()[_0xf3bf('0x20')](function(_0x4f11fe){if(_0x4f11fe){_0x6e7289=_0x4f11fe;}return db['Setting'][_0xf3bf('0x54')]({'where':{'id':_0x2f499f[_0xf3bf('0x51')]['id']},'attributes':['logo','loginLogo',_0xf3bf('0x5f'),'favicon','defaultLogo',_0xf3bf('0x62'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0xf3bf('0x20')](handleEntityNotFound(_0x4b5fd7,null))[_0xf3bf('0x20')](function(_0x2dee52){if(_0x2dee52){var _0x4a74e7=_0x2dee52[_0xf3bf('0x60')]&&fs[_0xf3bf('0x65')](path['join'](config[_0xf3bf('0x66')],_0x3697d1,_[_0xf3bf('0x68')](_0x2dee52[_0xf3bf('0x60')])))?path[_0xf3bf('0x67')](config[_0xf3bf('0x66')],_0x3697d1,_[_0xf3bf('0x68')](_0x2dee52[_0xf3bf('0x60')])):path[_0xf3bf('0x67')](config[_0xf3bf('0x66')],_0x3697d1,_['toLower'](_0xf3bf('0x78')));var _0x30e2d2='default'+_['upperFirst'](_0xf3bf('0x60'));if(_0x2dee52[_0x30e2d2]||!_0x6e7289['custom']){_0x4a74e7=path['join'](config[_0xf3bf('0x66')],_0x3697d1,_[_0xf3bf('0x68')](_0xf3bf('0x78')));}if(!fs[_0xf3bf('0x65')](_0x4a74e7)){throw new db[(_0xf3bf('0x76'))][(_0xf3bf('0x71'))](_[_0xf3bf('0x6b')](_0xf3bf('0x60'))+'\x20not\x20found');}return _0x4b5fd7[_0xf3bf('0x72')](_0x4a74e7);}})['catch'](handleError(_0x4b5fd7,null));};exports['getDate']=function(_0x42b220,_0x5a9868){var _0x452ef7={'offset':moment()[_0xf3bf('0x79')]()};_0x452ef7[_0xf3bf('0x7a')]=moment()['utcOffset'](_0x452ef7[_0xf3bf('0x2d')])[_0xf3bf('0x7b')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x5a9868[_0xf3bf('0x29')](0xc8)[_0xf3bf('0x36')](_0x452ef7);};