3a80fe9dda4839dde015ec9b641058e5309b4baf
[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 _0xb13b=['ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','client','http','request','Setting,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','end','status','json','offset','count','limit','set','Content-Range','apply','reject','save','update','then','name','index','map','Setting','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','params','keys','include','find','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','server/files/images/logos','getLicense','preferred','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','root','toLower','join','default_logo.svg','default','custom','Sequelize','ValidationError','upperFirst','\x20not\x20found','getLogoLogin','default_loginLogo.svg','gdpr','securePassword','addPreferred','getPreferred','favicon','default_preferred.png','download','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv'];(function(_0x2742db,_0x58e00c){var _0x18659e=function(_0x5bd3ac){while(--_0x5bd3ac){_0x2742db['push'](_0x2742db['shift']());}};_0x18659e(++_0x58e00c);}(_0xb13b,0x1de));var _0xbb13=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xb13b[_0x5d4607];return _0x5e4a86;};'use strict';var emlformat=require(_0xbb13('0x0'));var rimraf=require(_0xbb13('0x1'));var zipdir=require(_0xbb13('0x2'));var jsonpatch=require(_0xbb13('0x3'));var rp=require(_0xbb13('0x4'));var moment=require('moment');var BPromise=require(_0xbb13('0x5'));var Mustache=require(_0xbb13('0x6'));var util=require('util');var path=require(_0xbb13('0x7'));var sox=require(_0xbb13('0x8'));var csv=require(_0xbb13('0x9'));var ejs=require(_0xbb13('0xa'));var fs=require('fs');var fs_extra=require(_0xbb13('0xb'));var _=require(_0xbb13('0xc'));var squel=require(_0xbb13('0xd'));var crypto=require(_0xbb13('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbb13('0x9'));var querystring=require(_0xbb13('0xf'));var Papa=require(_0xbb13('0x10'));var Redis=require(_0xbb13('0x11'));var authService=require(_0xbb13('0x12'));var qs=require(_0xbb13('0x13'));var as=require(_0xbb13('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbb13('0x15'))(_0xbb13('0x16'));var utils=require(_0xbb13('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xbb13('0x18'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0xbb13('0x19')][_0xbb13('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0xb696b9,_0x1531af,_0x558bac,_0x11e664){return new BPromise(function(_0x58f59d,_0x3eda54){var _0x5f1473=_0x11e664||client;return _0x5f1473[_0xbb13('0x1b')](_0xb696b9,_0x558bac)['then'](function(_0x1ee7a6){logger['info'](_0xbb13('0x1c'),_0x1531af,_0xbb13('0x1d'));logger[_0xbb13('0x1e')]('Setting,\x20%s,\x20%s,\x20%s',_0x1531af,'request\x20sent',JSON['stringify'](_0x1ee7a6));if(_0x1ee7a6[_0xbb13('0x1f')]){if(_0x1ee7a6['error']['code']===0x1f4){logger['error'](_0xbb13('0x1c'),_0x1531af,_0x1ee7a6[_0xbb13('0x1f')][_0xbb13('0x20')]);return _0x3eda54(_0x1ee7a6[_0xbb13('0x1f')][_0xbb13('0x20')]);}logger[_0xbb13('0x1f')]('Setting,\x20%s,\x20%s',_0x1531af,_0x1ee7a6[_0xbb13('0x1f')][_0xbb13('0x20')]);return _0x58f59d(_0x1ee7a6[_0xbb13('0x1f')][_0xbb13('0x20')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x1531af,_0xbb13('0x1d'));_0x58f59d(_0x1ee7a6[_0xbb13('0x21')][_0xbb13('0x20')]);}})[_0xbb13('0x22')](function(_0x4ac38f){logger[_0xbb13('0x1f')](_0xbb13('0x1c'),_0x1531af,_0x4ac38f);_0x3eda54(_0x4ac38f);});});}function respondWithStatusCode(_0xc119cc,_0x4d64b7){_0x4d64b7=_0x4d64b7||0xcc;return function(_0x4319c3){if(_0x4319c3){return _0xc119cc['sendStatus'](_0x4d64b7);}return _0xc119cc['status'](_0x4d64b7)[_0xbb13('0x23')]();};}function respondWithResult(_0x2a41a1,_0x2ba6b6){_0x2ba6b6=_0x2ba6b6||0xc8;return function(_0x259e48){if(_0x259e48){return _0x2a41a1[_0xbb13('0x24')](_0x2ba6b6)[_0xbb13('0x25')](_0x259e48);}};}function respondWithFilteredResult(_0xb1063d,_0x3872f3){return function(_0x16e451){if(_0x16e451){var _0x1f8e5b=typeof _0x3872f3[_0xbb13('0x26')]==='undefined'&&typeof _0x3872f3['limit']==='undefined';var _0x4348ae=_0x16e451[_0xbb13('0x27')];var _0x1531cf=_0x1f8e5b?0x0:_0x3872f3[_0xbb13('0x26')];var _0x21b19d=_0x1f8e5b?_0x16e451[_0xbb13('0x27')]:_0x3872f3[_0xbb13('0x26')]+_0x3872f3[_0xbb13('0x28')];var _0x3cb80a;if(_0x21b19d>=_0x4348ae){_0x21b19d=_0x4348ae;_0x3cb80a=0xc8;}else{_0x3cb80a=0xce;}_0xb1063d['status'](_0x3cb80a);return _0xb1063d[_0xbb13('0x29')](_0xbb13('0x2a'),_0x1531cf+'-'+_0x21b19d+'/'+_0x4348ae)[_0xbb13('0x25')](_0x16e451);}return null;};}function patchUpdates(_0x251137){return function(_0x485b27){try{jsonpatch[_0xbb13('0x2b')](_0x485b27,_0x251137,!![]);}catch(_0x51d3b9){return BPromise[_0xbb13('0x2c')](_0x51d3b9);}return _0x485b27[_0xbb13('0x2d')]();};}function saveUpdates(_0x50d62f,_0x3c6f8c){return function(_0x5599e2){if(_0x5599e2){return _0x5599e2[_0xbb13('0x2e')](_0x50d62f)[_0xbb13('0x2f')](function(_0x2192b0){return _0x2192b0;});}return null;};}function removeEntity(_0x1dd82b,_0x2ca22b){return function(_0x87f68c){if(_0x87f68c){return _0x87f68c['destroy']()['then'](function(){_0x1dd82b[_0xbb13('0x24')](0xcc)[_0xbb13('0x23')]();});}};}function handleEntityNotFound(_0x45586f,_0x14014f){return function(_0x53853b){if(!_0x53853b){_0x45586f['sendStatus'](0x194);}return _0x53853b;};}function handleError(_0x3b53ff,_0x21080d){_0x21080d=_0x21080d||0x1f4;return function(_0x4e3501){logger[_0xbb13('0x1f')](_0x4e3501['stack']);if(_0x4e3501[_0xbb13('0x30')]){delete _0x4e3501[_0xbb13('0x30')];}_0x3b53ff['status'](_0x21080d)['send'](_0x4e3501);};}exports[_0xbb13('0x31')]=function(_0x399cc5,_0x51e236){var _0x29e86d={},_0x33dd55={},_0x12a553={'count':0x0,'rows':[]};var _0x380d8c=_[_0xbb13('0x32')](db[_0xbb13('0x33')][_0xbb13('0x34')],function(_0x29d310){return{'name':_0x29d310[_0xbb13('0x35')],'type':_0x29d310[_0xbb13('0x36')][_0xbb13('0x37')]};});_0x33dd55[_0xbb13('0x38')]=_[_0xbb13('0x32')](_0x380d8c,'name');_0x33dd55[_0xbb13('0x39')]=_['keys'](_0x399cc5['query']);_0x33dd55[_0xbb13('0x3a')]=_[_0xbb13('0x3b')](_0x33dd55[_0xbb13('0x38')],_0x33dd55[_0xbb13('0x39')]);_0x29e86d['attributes']=_[_0xbb13('0x3b')](_0x33dd55['model'],qs[_0xbb13('0x3c')](_0x399cc5[_0xbb13('0x39')][_0xbb13('0x3c')]));_0x29e86d[_0xbb13('0x3d')]=_0x29e86d[_0xbb13('0x3d')][_0xbb13('0x3e')]?_0x29e86d[_0xbb13('0x3d')]:_0x33dd55[_0xbb13('0x38')];if(!_0x399cc5[_0xbb13('0x39')][_0xbb13('0x3f')](_0xbb13('0x40'))){_0x29e86d['limit']=qs['limit'](_0x399cc5[_0xbb13('0x39')][_0xbb13('0x28')]);_0x29e86d[_0xbb13('0x26')]=qs[_0xbb13('0x26')](_0x399cc5['query']['offset']);}_0x29e86d['order']=qs[_0xbb13('0x41')](_0x399cc5[_0xbb13('0x39')][_0xbb13('0x41')]);_0x29e86d[_0xbb13('0x42')]=qs['filters'](_[_0xbb13('0x43')](_0x399cc5['query'],_0x33dd55[_0xbb13('0x3a')]),_0x380d8c);if(_0x399cc5[_0xbb13('0x39')]['filter']){_0x29e86d[_0xbb13('0x42')]=_[_0xbb13('0x44')](_0x29e86d[_0xbb13('0x42')],{'$or':_[_0xbb13('0x32')](_0x380d8c,function(_0x4ff149){if(_0x4ff149[_0xbb13('0x36')]!==_0xbb13('0x45')){var _0x22c645={};_0x22c645[_0x4ff149['name']]={'$like':'%'+_0x399cc5[_0xbb13('0x39')][_0xbb13('0x46')]+'%'};return _0x22c645;}})});}_0x29e86d=_[_0xbb13('0x44')]({},_0x29e86d,_0x399cc5[_0xbb13('0x47')]);var _0x4765cb={'where':_0x29e86d[_0xbb13('0x42')]};return db[_0xbb13('0x33')][_0xbb13('0x27')](_0x4765cb)[_0xbb13('0x2f')](function(_0x3aea8d){_0x12a553[_0xbb13('0x27')]=_0x3aea8d;if(_0x399cc5[_0xbb13('0x39')][_0xbb13('0x48')]){_0x29e86d['include']=[{'all':!![]}];}return db[_0xbb13('0x33')][_0xbb13('0x49')](_0x29e86d);})[_0xbb13('0x2f')](function(_0xd03995){_0x12a553[_0xbb13('0x4a')]=_0xd03995;return _0x12a553;})[_0xbb13('0x2f')](respondWithFilteredResult(_0x51e236,_0x29e86d))[_0xbb13('0x22')](handleError(_0x51e236,null));};exports['show']=function(_0x3cd945,_0x225f31){var _0x11875d={'raw':![],'where':{'id':_0x3cd945[_0xbb13('0x4b')]['id']}},_0x2d7716={};_0x2d7716[_0xbb13('0x38')]=_[_0xbb13('0x4c')](db[_0xbb13('0x33')][_0xbb13('0x34')]);_0x2d7716[_0xbb13('0x39')]=_[_0xbb13('0x4c')](_0x3cd945[_0xbb13('0x39')]);_0x2d7716[_0xbb13('0x3a')]=_[_0xbb13('0x3b')](_0x2d7716[_0xbb13('0x38')],_0x2d7716[_0xbb13('0x39')]);_0x11875d[_0xbb13('0x3d')]=_['intersection'](_0x2d7716[_0xbb13('0x38')],qs[_0xbb13('0x3c')](_0x3cd945[_0xbb13('0x39')][_0xbb13('0x3c')]));_0x11875d[_0xbb13('0x3d')]=_0x11875d[_0xbb13('0x3d')][_0xbb13('0x3e')]?_0x11875d[_0xbb13('0x3d')]:_0x2d7716[_0xbb13('0x38')];if(_0x3cd945['query'][_0xbb13('0x48')]){_0x11875d[_0xbb13('0x4d')]=[{'all':!![]}];}_0x11875d=_[_0xbb13('0x44')]({},_0x11875d,_0x3cd945[_0xbb13('0x47')]);return db[_0xbb13('0x33')]['find'](_0x11875d)[_0xbb13('0x2f')](handleEntityNotFound(_0x225f31,null))['then'](respondWithResult(_0x225f31,null))['catch'](handleError(_0x225f31,null));};exports[_0xbb13('0x2e')]=function(_0x3f26ab,_0x45ac80){if(_0x3f26ab['body']['id']){delete _0x3f26ab['body']['id'];}return db['Setting'][_0xbb13('0x4e')]({'where':{'id':_0x3f26ab[_0xbb13('0x4b')]['id']}})['then'](handleEntityNotFound(_0x45ac80,null))[_0xbb13('0x2f')](saveUpdates(_0x3f26ab[_0xbb13('0x4f')],null))[_0xbb13('0x2f')](respondWithResult(_0x45ac80,null))[_0xbb13('0x22')](handleError(_0x45ac80,null));};exports[_0xbb13('0x50')]=function(_0x5312a9,_0x3a664d,_0x590a9f){if(_0x5312a9['file']&&_0x5312a9[_0xbb13('0x51')][_0xbb13('0x52')]){_0x5312a9[_0xbb13('0x4f')][_0xbb13('0x53')]=_0x5312a9[_0xbb13('0x51')][_0xbb13('0x52')];}return db['Setting'][_0xbb13('0x4e')]({'where':{'id':_0x5312a9[_0xbb13('0x4b')]['id']}})[_0xbb13('0x2f')](handleEntityNotFound(_0x3a664d,null))[_0xbb13('0x2f')](saveUpdates(_0x5312a9[_0xbb13('0x4f')],null))[_0xbb13('0x2f')](respondWithResult(_0x3a664d,null))[_0xbb13('0x22')](handleError(_0x3a664d,null));};exports[_0xbb13('0x54')]=function(_0x59a226,_0x2e2f8b,_0x587185){if(_0x59a226['file']&&_0x59a226[_0xbb13('0x51')][_0xbb13('0x52')]){_0x59a226['body'][_0xbb13('0x55')]=_0x59a226[_0xbb13('0x51')][_0xbb13('0x52')];}return db['Setting'][_0xbb13('0x4e')]({'where':{'id':_0x59a226[_0xbb13('0x4b')]['id']}})[_0xbb13('0x2f')](handleEntityNotFound(_0x2e2f8b,null))[_0xbb13('0x2f')](saveUpdates(_0x59a226['body'],null))[_0xbb13('0x2f')](respondWithResult(_0x2e2f8b,null))[_0xbb13('0x22')](handleError(_0x2e2f8b,null));};var utilLicense=require(_0xbb13('0x18'));exports['getLogo']=function(_0x585a05,_0x508007,_0x5846e6){var _0x46c55b=_0xbb13('0x56');var _0x18d148={'custom':![]};return utilLicense[_0xbb13('0x57')]()[_0xbb13('0x2f')](function(_0x19ee96){if(_0x19ee96){_0x18d148=_0x19ee96;}return db['Setting'][_0xbb13('0x4e')]({'where':{'id':_0x585a05['params']['id']},'attributes':[_0xbb13('0x53'),'loginLogo',_0xbb13('0x58'),'favicon',_0xbb13('0x59'),_0xbb13('0x5a'),_0xbb13('0x5b'),_0xbb13('0x5c')],'raw':!![]});})[_0xbb13('0x2f')](handleEntityNotFound(_0x508007,null))[_0xbb13('0x2f')](function(_0x443fe5){if(_0x443fe5){var _0x1e61cd=_0x443fe5[_0xbb13('0x53')]&&fs[_0xbb13('0x5d')](path['join'](config[_0xbb13('0x5e')],_0x46c55b,_[_0xbb13('0x5f')](_0x443fe5[_0xbb13('0x53')])))?path[_0xbb13('0x60')](config[_0xbb13('0x5e')],_0x46c55b,_[_0xbb13('0x5f')](_0x443fe5[_0xbb13('0x53')])):path[_0xbb13('0x60')](config[_0xbb13('0x5e')],_0x46c55b,_['toLower'](_0xbb13('0x61')));var _0x4e083f=_0xbb13('0x62')+_['upperFirst'](_0xbb13('0x53'));if(_0x443fe5[_0x4e083f]||!_0x18d148[_0xbb13('0x63')]){_0x1e61cd=path['join'](config[_0xbb13('0x5e')],_0x46c55b,_['toLower'](_0xbb13('0x61')));}if(!fs[_0xbb13('0x5d')](_0x1e61cd)){throw new db[(_0xbb13('0x64'))][(_0xbb13('0x65'))](_[_0xbb13('0x66')](_0xbb13('0x53'))+_0xbb13('0x67'));}return _0x508007['download'](_0x1e61cd);}})[_0xbb13('0x22')](handleError(_0x508007,null));};var utilLicense=require(_0xbb13('0x18'));exports[_0xbb13('0x68')]=function(_0x58c8a8,_0x11d612,_0x29092e){var _0x4b5237=_0xbb13('0x56');var _0x9e3fe1={'custom':![]};return utilLicense[_0xbb13('0x57')]()[_0xbb13('0x2f')](function(_0x2df60f){if(_0x2df60f){_0x9e3fe1=_0x2df60f;}return db[_0xbb13('0x33')][_0xbb13('0x4e')]({'where':{'id':_0x58c8a8[_0xbb13('0x4b')]['id']},'attributes':[_0xbb13('0x53'),_0xbb13('0x55'),_0xbb13('0x58'),'favicon',_0xbb13('0x59'),'defaultLoginLogo','defaultPreferred','defaultFavicon'],'raw':!![]});})[_0xbb13('0x2f')](handleEntityNotFound(_0x11d612,null))[_0xbb13('0x2f')](function(_0xa68dd0){if(_0xa68dd0){var _0x3b9fa0=_0xa68dd0[_0xbb13('0x55')]&&fs[_0xbb13('0x5d')](path[_0xbb13('0x60')](config['root'],_0x4b5237,_[_0xbb13('0x5f')](_0xa68dd0['loginLogo'])))?path['join'](config[_0xbb13('0x5e')],_0x4b5237,_['toLower'](_0xa68dd0[_0xbb13('0x55')])):path[_0xbb13('0x60')](config[_0xbb13('0x5e')],_0x4b5237,_[_0xbb13('0x5f')](_0xbb13('0x69')));var _0x4e658c='default'+_[_0xbb13('0x66')]('loginLogo');if(_0xa68dd0[_0x4e658c]||!_0x9e3fe1[_0xbb13('0x63')]){_0x3b9fa0=path[_0xbb13('0x60')](config['root'],_0x4b5237,_[_0xbb13('0x5f')](_0xbb13('0x69')));}if(!fs[_0xbb13('0x5d')](_0x3b9fa0)){throw new db['Sequelize'][(_0xbb13('0x65'))](_[_0xbb13('0x66')]('loginLogo')+'\x20not\x20found');}return _0x11d612['download'](_0x3b9fa0);}})[_0xbb13('0x22')](handleError(_0x11d612,null));};exports[_0xbb13('0x6a')]=function(_0x2b0a2a,_0x31ca0e){return db[_0xbb13('0x33')][_0xbb13('0x4e')]({'where':{'id':_0x2b0a2a[_0xbb13('0x4b')]['id']},'attributes':[_0xbb13('0x6b')]})[_0xbb13('0x2f')](respondWithResult(_0x31ca0e,null))[_0xbb13('0x22')](handleError(_0x31ca0e,null));};exports[_0xbb13('0x6c')]=function(_0x3a208e,_0x17108f,_0x458e97){if(_0x3a208e['file']&&_0x3a208e[_0xbb13('0x51')][_0xbb13('0x52')]){_0x3a208e[_0xbb13('0x4f')][_0xbb13('0x58')]=_0x3a208e[_0xbb13('0x51')]['filename'];}return db[_0xbb13('0x33')]['find']({'where':{'id':_0x3a208e[_0xbb13('0x4b')]['id']}})['then'](handleEntityNotFound(_0x17108f,null))['then'](saveUpdates(_0x3a208e[_0xbb13('0x4f')],null))['then'](respondWithResult(_0x17108f,null))[_0xbb13('0x22')](handleError(_0x17108f,null));};var utilLicense=require(_0xbb13('0x18'));exports[_0xbb13('0x6d')]=function(_0x48c191,_0x24b99e,_0x482475){var _0x5eccc9='server/files/images/logos';var _0x556ba7={'custom':![]};return utilLicense[_0xbb13('0x57')]()[_0xbb13('0x2f')](function(_0x4fc595){if(_0x4fc595){_0x556ba7=_0x4fc595;}return db['Setting'][_0xbb13('0x4e')]({'where':{'id':_0x48c191[_0xbb13('0x4b')]['id']},'attributes':['logo',_0xbb13('0x55'),_0xbb13('0x58'),_0xbb13('0x6e'),'defaultLogo',_0xbb13('0x5a'),_0xbb13('0x5b'),_0xbb13('0x5c')],'raw':!![]});})[_0xbb13('0x2f')](handleEntityNotFound(_0x24b99e,null))[_0xbb13('0x2f')](function(_0x3cfe26){if(_0x3cfe26){var _0x2444c7=_0x3cfe26[_0xbb13('0x58')]&&fs[_0xbb13('0x5d')](path[_0xbb13('0x60')](config[_0xbb13('0x5e')],_0x5eccc9,_[_0xbb13('0x5f')](_0x3cfe26[_0xbb13('0x58')])))?path['join'](config[_0xbb13('0x5e')],_0x5eccc9,_[_0xbb13('0x5f')](_0x3cfe26[_0xbb13('0x58')])):path[_0xbb13('0x60')](config[_0xbb13('0x5e')],_0x5eccc9,_[_0xbb13('0x5f')]('default_preferred.png'));var _0x232315=_0xbb13('0x62')+_[_0xbb13('0x66')]('preferred');if(_0x3cfe26[_0x232315]||!_0x556ba7[_0xbb13('0x63')]||!_0x556ba7[_0xbb13('0x58')]){_0x2444c7=path[_0xbb13('0x60')](config[_0xbb13('0x5e')],_0x5eccc9,_[_0xbb13('0x5f')](_0xbb13('0x6f')));}if(!fs[_0xbb13('0x5d')](_0x2444c7)){throw new db[(_0xbb13('0x64'))][(_0xbb13('0x65'))](_['upperFirst']('preferred')+_0xbb13('0x67'));}return _0x24b99e[_0xbb13('0x70')](_0x2444c7);}})[_0xbb13('0x22')](handleError(_0x24b99e,null));};exports[_0xbb13('0x71')]=function(_0x2436f6,_0x19e6c8,_0x1e579b){if(_0x2436f6[_0xbb13('0x51')]&&_0x2436f6[_0xbb13('0x51')]['filename']){_0x2436f6[_0xbb13('0x4f')][_0xbb13('0x6e')]=_0x2436f6[_0xbb13('0x51')][_0xbb13('0x52')];}return db[_0xbb13('0x33')]['find']({'where':{'id':_0x2436f6[_0xbb13('0x4b')]['id']}})[_0xbb13('0x2f')](handleEntityNotFound(_0x19e6c8,null))[_0xbb13('0x2f')](saveUpdates(_0x2436f6[_0xbb13('0x4f')],null))[_0xbb13('0x2f')](respondWithResult(_0x19e6c8,null))[_0xbb13('0x22')](handleError(_0x19e6c8,null));};var utilLicense=require(_0xbb13('0x18'));exports[_0xbb13('0x72')]=function(_0x1282dd,_0xbd302f,_0x426190){var _0xb88f97=_0xbb13('0x56');var _0x11d52c={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x57f2b5){if(_0x57f2b5){_0x11d52c=_0x57f2b5;}return db['Setting'][_0xbb13('0x4e')]({'where':{'id':_0x1282dd[_0xbb13('0x4b')]['id']},'attributes':['logo',_0xbb13('0x55'),_0xbb13('0x58'),'favicon',_0xbb13('0x59'),'defaultLoginLogo',_0xbb13('0x5b'),_0xbb13('0x5c')],'raw':!![]});})[_0xbb13('0x2f')](handleEntityNotFound(_0xbd302f,null))[_0xbb13('0x2f')](function(_0x32afce){if(_0x32afce){var _0x439986=_0x32afce['favicon']&&fs[_0xbb13('0x5d')](path['join'](config[_0xbb13('0x5e')],_0xb88f97,_[_0xbb13('0x5f')](_0x32afce[_0xbb13('0x6e')])))?path['join'](config['root'],_0xb88f97,_[_0xbb13('0x5f')](_0x32afce[_0xbb13('0x6e')])):path[_0xbb13('0x60')](config['root'],_0xb88f97,_[_0xbb13('0x5f')](_0xbb13('0x73')));var _0x32ae1e=_0xbb13('0x62')+_['upperFirst'](_0xbb13('0x6e'));if(_0x32afce[_0x32ae1e]||!_0x11d52c[_0xbb13('0x63')]){_0x439986=path[_0xbb13('0x60')](config[_0xbb13('0x5e')],_0xb88f97,_[_0xbb13('0x5f')]('default_favicon.ico'));}if(!fs[_0xbb13('0x5d')](_0x439986)){throw new db[(_0xbb13('0x64'))][(_0xbb13('0x65'))](_['upperFirst']('favicon')+_0xbb13('0x67'));}return _0xbd302f[_0xbb13('0x70')](_0x439986);}})[_0xbb13('0x22')](handleError(_0xbd302f,null));};exports[_0xbb13('0x74')]=function(_0x6e715a,_0x371641){var _0x3932f7={'offset':moment()[_0xbb13('0x75')]()};_0x3932f7[_0xbb13('0x76')]=moment()['utcOffset'](_0x3932f7[_0xbb13('0x26')])[_0xbb13('0x77')](_0xbb13('0x78'));return _0x371641[_0xbb13('0x24')](0xc8)[_0xbb13('0x79')](_0x3932f7);};