Built motion from commit (unavailable).|2.5.23
[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 _0x7172=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','index','map','Setting','rawAttributes','fieldName','type','key','model','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','body','addLogo','file','filename','loginLogo','getLogo','server/files/images/logos','getLicense','logo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','join','root','toLower','default_logo.svg','default','upperFirst','custom','existsSync','Sequelize','\x20not\x20found','default_loginLogo.svg','ValidationError','download','gdpr','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','send','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','desk.js','querystring','ioredis'];(function(_0x276986,_0x58a02e){var _0x1b9e9e=function(_0x29d5af){while(--_0x29d5af){_0x276986['push'](_0x276986['shift']());}};_0x1b9e9e(++_0x58a02e);}(_0x7172,0x6e));var _0x2717=function(_0x5e8912,_0x5b6370){_0x5e8912=_0x5e8912-0x0;var _0xb5060b=_0x7172[_0x5e8912];return _0xb5060b;};'use strict';var pdf=require(_0x2717('0x0'));var emlformat=require(_0x2717('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2717('0x2'));var jsonpatch=require(_0x2717('0x3'));var rp=require('request-promise');var moment=require(_0x2717('0x4'));var BPromise=require(_0x2717('0x5'));var Mustache=require(_0x2717('0x6'));var util=require(_0x2717('0x7'));var path=require(_0x2717('0x8'));var sox=require(_0x2717('0x9'));var csv=require(_0x2717('0xa'));var ejs=require(_0x2717('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2717('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2717('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2717('0xe'));var Papa=require('papaparse');var Redis=require(_0x2717('0xf'));var authService=require(_0x2717('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2717('0x11'));var hardwareService=require(_0x2717('0x12'));var logger=require(_0x2717('0x13'))('api');var utils=require(_0x2717('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2717('0x15'));var db=require(_0x2717('0x16'))['db'];var jayson=require(_0x2717('0x17'));var client=jayson[_0x2717('0x18')][_0x2717('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x3bf238,_0x2bc3d,_0x1b0892,_0x125fa7){return new BPromise(function(_0x3764e4,_0x102ca3){var _0x5540a2=_0x125fa7||client;return _0x5540a2[_0x2717('0x1a')](_0x3bf238,_0x1b0892)[_0x2717('0x1b')](function(_0x50c999){logger['info'](_0x2717('0x1c'),_0x2bc3d,_0x2717('0x1d'));logger[_0x2717('0x1e')](_0x2717('0x1f'),_0x2bc3d,_0x2717('0x1d'),JSON[_0x2717('0x20')](_0x50c999));if(_0x50c999[_0x2717('0x21')]){if(_0x50c999[_0x2717('0x21')][_0x2717('0x22')]===0x1f4){logger[_0x2717('0x21')]('Setting,\x20%s,\x20%s',_0x2bc3d,_0x50c999['error']['message']);return _0x102ca3(_0x50c999[_0x2717('0x21')][_0x2717('0x23')]);}logger[_0x2717('0x21')](_0x2717('0x1c'),_0x2bc3d,_0x50c999['error'][_0x2717('0x23')]);return _0x3764e4(_0x50c999['error'][_0x2717('0x23')]);}else{logger[_0x2717('0x24')](_0x2717('0x1c'),_0x2bc3d,_0x2717('0x1d'));_0x3764e4(_0x50c999[_0x2717('0x25')][_0x2717('0x23')]);}})['catch'](function(_0x521e24){logger[_0x2717('0x21')]('Setting,\x20%s,\x20%s',_0x2bc3d,_0x521e24);_0x102ca3(_0x521e24);});});}function respondWithStatusCode(_0x1d7b86,_0xb881f9){_0xb881f9=_0xb881f9||0xcc;return function(_0x2e1669){if(_0x2e1669){return _0x1d7b86[_0x2717('0x26')](_0xb881f9);}return _0x1d7b86[_0x2717('0x27')](_0xb881f9)[_0x2717('0x28')]();};}function respondWithResult(_0x6175de,_0x29564e){_0x29564e=_0x29564e||0xc8;return function(_0x3e07fd){if(_0x3e07fd){return _0x6175de[_0x2717('0x27')](_0x29564e)[_0x2717('0x29')](_0x3e07fd);}};}function respondWithFilteredResult(_0x2f28ee,_0x33a016){return function(_0x566a02){if(_0x566a02){var _0x4a0e7f=_0x566a02[_0x2717('0x2a')],_0x51746a=_0x33a016['offset'],_0x61ca94=_0x33a016[_0x2717('0x2b')]+_0x33a016[_0x2717('0x2c')],_0x14ed87;if(_0x61ca94>=_0x4a0e7f){_0x61ca94=_0x4a0e7f;_0x14ed87=0xc8;}else{_0x14ed87=0xce;}_0x2f28ee['status'](_0x14ed87);return _0x2f28ee[_0x2717('0x2d')](_0x2717('0x2e'),_0x51746a+'-'+_0x61ca94+'/'+_0x4a0e7f)['json'](_0x566a02);}return null;};}function patchUpdates(_0x2bc209){return function(_0x2ea11e){try{jsonpatch[_0x2717('0x2f')](_0x2ea11e,_0x2bc209,!![]);}catch(_0x2ecfab){return BPromise[_0x2717('0x30')](_0x2ecfab);}return _0x2ea11e[_0x2717('0x31')]();};}function saveUpdates(_0x4d3bdc,_0x3b0bfc){return function(_0xa5acb8){if(_0xa5acb8){return _0xa5acb8[_0x2717('0x32')](_0x4d3bdc)[_0x2717('0x1b')](function(_0x3fd28c){return _0x3fd28c;});}return null;};}function removeEntity(_0x36e21a,_0x17e720){return function(_0x28cc18){if(_0x28cc18){return _0x28cc18[_0x2717('0x33')]()[_0x2717('0x1b')](function(){_0x36e21a[_0x2717('0x27')](0xcc)[_0x2717('0x28')]();});}};}function handleEntityNotFound(_0x533164,_0x1b1c09){return function(_0xd726c3){if(!_0xd726c3){_0x533164[_0x2717('0x26')](0x194);}return _0xd726c3;};}function handleError(_0x18c47d,_0x358e2d){_0x358e2d=_0x358e2d||0x1f4;return function(_0x180bfc){logger[_0x2717('0x21')](_0x180bfc[_0x2717('0x34')]);if(_0x180bfc['name']){delete _0x180bfc['name'];}_0x18c47d[_0x2717('0x27')](_0x358e2d)['send'](_0x180bfc);};}exports[_0x2717('0x35')]=function(_0x498b4d,_0x38b351){var _0x232039={},_0x32e54d={},_0x5840c7={'count':0x0,'rows':[]};var _0x345980=_[_0x2717('0x36')](db[_0x2717('0x37')][_0x2717('0x38')],function(_0x24d393){return{'name':_0x24d393[_0x2717('0x39')],'type':_0x24d393[_0x2717('0x3a')][_0x2717('0x3b')]};});_0x32e54d[_0x2717('0x3c')]=_[_0x2717('0x36')](_0x345980,_0x2717('0x3d'));_0x32e54d['query']=_[_0x2717('0x3e')](_0x498b4d[_0x2717('0x3f')]);_0x32e54d[_0x2717('0x40')]=_[_0x2717('0x41')](_0x32e54d['model'],_0x32e54d[_0x2717('0x3f')]);_0x232039[_0x2717('0x42')]=_[_0x2717('0x41')](_0x32e54d['model'],qs[_0x2717('0x43')](_0x498b4d[_0x2717('0x3f')]['fields']));_0x232039['attributes']=_0x232039['attributes'][_0x2717('0x44')]?_0x232039[_0x2717('0x42')]:_0x32e54d[_0x2717('0x3c')];if(!_0x498b4d[_0x2717('0x3f')][_0x2717('0x45')](_0x2717('0x46'))){_0x232039[_0x2717('0x2c')]=qs[_0x2717('0x2c')](_0x498b4d['query'][_0x2717('0x2c')]);_0x232039['offset']=qs[_0x2717('0x2b')](_0x498b4d[_0x2717('0x3f')][_0x2717('0x2b')]);}_0x232039[_0x2717('0x47')]=qs['sort'](_0x498b4d[_0x2717('0x3f')][_0x2717('0x48')]);_0x232039[_0x2717('0x49')]=qs['filters'](_['pick'](_0x498b4d[_0x2717('0x3f')],_0x32e54d[_0x2717('0x40')]),_0x345980);if(_0x498b4d['query'][_0x2717('0x4a')]){_0x232039[_0x2717('0x49')]=_['merge'](_0x232039[_0x2717('0x49')],{'$or':_[_0x2717('0x36')](_0x345980,function(_0x1917ac){if(_0x1917ac[_0x2717('0x3a')]!=='VIRTUAL'){var _0x87f2cf={};_0x87f2cf[_0x1917ac['name']]={'$like':'%'+_0x498b4d[_0x2717('0x3f')][_0x2717('0x4a')]+'%'};return _0x87f2cf;}})});}_0x232039=_[_0x2717('0x4b')]({},_0x232039,_0x498b4d[_0x2717('0x4c')]);var _0x4ede8d={'where':_0x232039[_0x2717('0x49')]};return db[_0x2717('0x37')][_0x2717('0x2a')](_0x4ede8d)[_0x2717('0x1b')](function(_0x5296f3){_0x5840c7[_0x2717('0x2a')]=_0x5296f3;if(_0x498b4d['query'][_0x2717('0x4d')]){_0x232039[_0x2717('0x4e')]=[{'all':!![]}];}return db[_0x2717('0x37')][_0x2717('0x4f')](_0x232039);})[_0x2717('0x1b')](function(_0x3c43d2){_0x5840c7[_0x2717('0x50')]=_0x3c43d2;return _0x5840c7;})[_0x2717('0x1b')](respondWithFilteredResult(_0x38b351,_0x232039))[_0x2717('0x51')](handleError(_0x38b351,null));};exports[_0x2717('0x52')]=function(_0x3c90ed,_0x13af1f){var _0x40298a={'raw':![],'where':{'id':_0x3c90ed[_0x2717('0x53')]['id']}},_0x45d885={};_0x45d885[_0x2717('0x3c')]=_[_0x2717('0x3e')](db[_0x2717('0x37')]['rawAttributes']);_0x45d885[_0x2717('0x3f')]=_[_0x2717('0x3e')](_0x3c90ed[_0x2717('0x3f')]);_0x45d885[_0x2717('0x40')]=_[_0x2717('0x41')](_0x45d885['model'],_0x45d885[_0x2717('0x3f')]);_0x40298a[_0x2717('0x42')]=_[_0x2717('0x41')](_0x45d885[_0x2717('0x3c')],qs[_0x2717('0x43')](_0x3c90ed[_0x2717('0x3f')]['fields']));_0x40298a[_0x2717('0x42')]=_0x40298a[_0x2717('0x42')][_0x2717('0x44')]?_0x40298a['attributes']:_0x45d885[_0x2717('0x3c')];if(_0x3c90ed[_0x2717('0x3f')][_0x2717('0x4d')]){_0x40298a[_0x2717('0x4e')]=[{'all':!![]}];}_0x40298a=_['merge']({},_0x40298a,_0x3c90ed['options']);return db['Setting'][_0x2717('0x54')](_0x40298a)[_0x2717('0x1b')](handleEntityNotFound(_0x13af1f,null))['then'](respondWithResult(_0x13af1f,null))[_0x2717('0x51')](handleError(_0x13af1f,null));};exports['update']=function(_0x20866c,_0x523cfd){if(_0x20866c[_0x2717('0x55')]['id']){delete _0x20866c[_0x2717('0x55')]['id'];}return db[_0x2717('0x37')][_0x2717('0x54')]({'where':{'id':_0x20866c[_0x2717('0x53')]['id']}})['then'](handleEntityNotFound(_0x523cfd,null))['then'](saveUpdates(_0x20866c['body'],null))['then'](respondWithResult(_0x523cfd,null))[_0x2717('0x51')](handleError(_0x523cfd,null));};exports[_0x2717('0x56')]=function(_0x55ef90,_0xd9b884,_0xb3efdd){if(_0x55ef90[_0x2717('0x57')]&&_0x55ef90['file'][_0x2717('0x58')]){_0x55ef90['body']['logo']=_0x55ef90['file'][_0x2717('0x58')];}return db[_0x2717('0x37')]['find']({'where':{'id':_0x55ef90[_0x2717('0x53')]['id']}})[_0x2717('0x1b')](handleEntityNotFound(_0xd9b884,null))['then'](saveUpdates(_0x55ef90[_0x2717('0x55')],null))['then'](respondWithResult(_0xd9b884,null))[_0x2717('0x51')](handleError(_0xd9b884,null));};exports['addLogoLogin']=function(_0x317144,_0x44f0a9,_0xfd4abd){if(_0x317144[_0x2717('0x57')]&&_0x317144[_0x2717('0x57')][_0x2717('0x58')]){_0x317144['body'][_0x2717('0x59')]=_0x317144['file'][_0x2717('0x58')];}return db[_0x2717('0x37')][_0x2717('0x54')]({'where':{'id':_0x317144['params']['id']}})[_0x2717('0x1b')](handleEntityNotFound(_0x44f0a9,null))[_0x2717('0x1b')](saveUpdates(_0x317144[_0x2717('0x55')],null))[_0x2717('0x1b')](respondWithResult(_0x44f0a9,null))[_0x2717('0x51')](handleError(_0x44f0a9,null));};var utilLicense=require(_0x2717('0x15'));exports[_0x2717('0x5a')]=function(_0x48c438,_0x2c8642,_0xde0411){var _0x4d33a8=_0x2717('0x5b');var _0x1e657b={'custom':![]};return utilLicense[_0x2717('0x5c')]()[_0x2717('0x1b')](function(_0x53060d){if(_0x53060d){_0x1e657b=_0x53060d;}return db[_0x2717('0x37')][_0x2717('0x54')]({'where':{'id':_0x48c438[_0x2717('0x53')]['id']},'attributes':[_0x2717('0x5d'),_0x2717('0x59'),_0x2717('0x5e'),_0x2717('0x5f'),_0x2717('0x60'),_0x2717('0x61'),_0x2717('0x62'),_0x2717('0x63')],'raw':!![]});})[_0x2717('0x1b')](handleEntityNotFound(_0x2c8642,null))[_0x2717('0x1b')](function(_0x35cab3){if(_0x35cab3){var _0x1d9394=_0x35cab3[_0x2717('0x5d')]&&fs['existsSync'](path[_0x2717('0x64')](config[_0x2717('0x65')],_0x4d33a8,_[_0x2717('0x66')](_0x35cab3['logo'])))?path[_0x2717('0x64')](config[_0x2717('0x65')],_0x4d33a8,_[_0x2717('0x66')](_0x35cab3[_0x2717('0x5d')])):path['join'](config[_0x2717('0x65')],_0x4d33a8,_[_0x2717('0x66')](_0x2717('0x67')));var _0x5bd7d1=_0x2717('0x68')+_[_0x2717('0x69')](_0x2717('0x5d'));if(_0x35cab3[_0x5bd7d1]||!_0x1e657b[_0x2717('0x6a')]){_0x1d9394=path['join'](config[_0x2717('0x65')],_0x4d33a8,_[_0x2717('0x66')]('default_logo.svg'));}if(!fs[_0x2717('0x6b')](_0x1d9394)){throw new db[(_0x2717('0x6c'))]['ValidationError'](_[_0x2717('0x69')]('logo')+_0x2717('0x6d'));}return _0x2c8642['download'](_0x1d9394);}})[_0x2717('0x51')](handleError(_0x2c8642,null));};var utilLicense=require(_0x2717('0x15'));exports['getLogoLogin']=function(_0x5ec563,_0xb9c289,_0x1dc4a6){var _0x3e9db7='server/files/images/logos';var _0x3985e3={'custom':![]};return utilLicense[_0x2717('0x5c')]()['then'](function(_0x363759){if(_0x363759){_0x3985e3=_0x363759;}return db[_0x2717('0x37')][_0x2717('0x54')]({'where':{'id':_0x5ec563[_0x2717('0x53')]['id']},'attributes':[_0x2717('0x5d'),_0x2717('0x59'),_0x2717('0x5e'),_0x2717('0x5f'),_0x2717('0x60'),_0x2717('0x61'),_0x2717('0x62'),_0x2717('0x63')],'raw':!![]});})['then'](handleEntityNotFound(_0xb9c289,null))[_0x2717('0x1b')](function(_0x5101d0){if(_0x5101d0){var _0x16eaa5=_0x5101d0['loginLogo']&&fs['existsSync'](path[_0x2717('0x64')](config[_0x2717('0x65')],_0x3e9db7,_[_0x2717('0x66')](_0x5101d0[_0x2717('0x59')])))?path[_0x2717('0x64')](config[_0x2717('0x65')],_0x3e9db7,_[_0x2717('0x66')](_0x5101d0[_0x2717('0x59')])):path['join'](config[_0x2717('0x65')],_0x3e9db7,_['toLower'](_0x2717('0x6e')));var _0x596650=_0x2717('0x68')+_['upperFirst'](_0x2717('0x59'));if(_0x5101d0[_0x596650]||!_0x3985e3['custom']){_0x16eaa5=path[_0x2717('0x64')](config[_0x2717('0x65')],_0x3e9db7,_[_0x2717('0x66')](_0x2717('0x6e')));}if(!fs['existsSync'](_0x16eaa5)){throw new db[(_0x2717('0x6c'))][(_0x2717('0x6f'))](_[_0x2717('0x69')]('loginLogo')+_0x2717('0x6d'));}return _0xb9c289[_0x2717('0x70')](_0x16eaa5);}})[_0x2717('0x51')](handleError(_0xb9c289,null));};exports[_0x2717('0x71')]=function(_0x4cf668,_0x4b1030){return db[_0x2717('0x37')]['find']({'where':{'id':_0x4cf668[_0x2717('0x53')]['id']},'attributes':['securePassword']})[_0x2717('0x1b')](respondWithResult(_0x4b1030,null))[_0x2717('0x51')](handleError(_0x4b1030,null));};exports[_0x2717('0x72')]=function(_0x3457e7,_0x38e6fc,_0x32c12c){if(_0x3457e7[_0x2717('0x57')]&&_0x3457e7[_0x2717('0x57')][_0x2717('0x58')]){_0x3457e7[_0x2717('0x55')]['preferred']=_0x3457e7[_0x2717('0x57')][_0x2717('0x58')];}return db[_0x2717('0x37')][_0x2717('0x54')]({'where':{'id':_0x3457e7['params']['id']}})[_0x2717('0x1b')](handleEntityNotFound(_0x38e6fc,null))[_0x2717('0x1b')](saveUpdates(_0x3457e7[_0x2717('0x55')],null))[_0x2717('0x1b')](respondWithResult(_0x38e6fc,null))[_0x2717('0x51')](handleError(_0x38e6fc,null));};var utilLicense=require(_0x2717('0x15'));exports[_0x2717('0x73')]=function(_0x1a1b31,_0x371986,_0x15c3fd){var _0x2af3fb='server/files/images/logos';var _0x351c33={'custom':![]};return utilLicense[_0x2717('0x5c')]()[_0x2717('0x1b')](function(_0x3c1f73){if(_0x3c1f73){_0x351c33=_0x3c1f73;}return db['Setting'][_0x2717('0x54')]({'where':{'id':_0x1a1b31['params']['id']},'attributes':[_0x2717('0x5d'),'loginLogo',_0x2717('0x5e'),'favicon',_0x2717('0x60'),'defaultLoginLogo','defaultPreferred',_0x2717('0x63')],'raw':!![]});})[_0x2717('0x1b')](handleEntityNotFound(_0x371986,null))[_0x2717('0x1b')](function(_0xc385e9){if(_0xc385e9){var _0x2a847b=_0xc385e9[_0x2717('0x5e')]&&fs[_0x2717('0x6b')](path[_0x2717('0x64')](config[_0x2717('0x65')],_0x2af3fb,_[_0x2717('0x66')](_0xc385e9[_0x2717('0x5e')])))?path[_0x2717('0x64')](config['root'],_0x2af3fb,_[_0x2717('0x66')](_0xc385e9[_0x2717('0x5e')])):path['join'](config[_0x2717('0x65')],_0x2af3fb,_['toLower'](_0x2717('0x74')));var _0x34ddf6=_0x2717('0x68')+_['upperFirst'](_0x2717('0x5e'));if(_0xc385e9[_0x34ddf6]||!_0x351c33['custom']||!_0x351c33[_0x2717('0x5e')]){_0x2a847b=path[_0x2717('0x64')](config[_0x2717('0x65')],_0x2af3fb,_[_0x2717('0x66')](_0x2717('0x74')));}if(!fs[_0x2717('0x6b')](_0x2a847b)){throw new db[(_0x2717('0x6c'))]['ValidationError'](_[_0x2717('0x69')](_0x2717('0x5e'))+_0x2717('0x6d'));}return _0x371986['download'](_0x2a847b);}})[_0x2717('0x51')](handleError(_0x371986,null));};exports[_0x2717('0x75')]=function(_0x2fd64e,_0x4856d5,_0x3af2e3){if(_0x2fd64e['file']&&_0x2fd64e['file'][_0x2717('0x58')]){_0x2fd64e[_0x2717('0x55')]['favicon']=_0x2fd64e[_0x2717('0x57')][_0x2717('0x58')];}return db[_0x2717('0x37')]['find']({'where':{'id':_0x2fd64e[_0x2717('0x53')]['id']}})[_0x2717('0x1b')](handleEntityNotFound(_0x4856d5,null))['then'](saveUpdates(_0x2fd64e[_0x2717('0x55')],null))[_0x2717('0x1b')](respondWithResult(_0x4856d5,null))['catch'](handleError(_0x4856d5,null));};var utilLicense=require(_0x2717('0x15'));exports[_0x2717('0x76')]=function(_0x3206d7,_0x4783dd,_0x1f05e7){var _0x3daa46=_0x2717('0x5b');var _0x40e8f4={'custom':![]};return utilLicense['getLicense']()[_0x2717('0x1b')](function(_0x1184d2){if(_0x1184d2){_0x40e8f4=_0x1184d2;}return db[_0x2717('0x37')][_0x2717('0x54')]({'where':{'id':_0x3206d7[_0x2717('0x53')]['id']},'attributes':['logo',_0x2717('0x59'),_0x2717('0x5e'),_0x2717('0x5f'),_0x2717('0x60'),'defaultLoginLogo',_0x2717('0x62'),_0x2717('0x63')],'raw':!![]});})[_0x2717('0x1b')](handleEntityNotFound(_0x4783dd,null))[_0x2717('0x1b')](function(_0x4122bd){if(_0x4122bd){var _0x19b411=_0x4122bd[_0x2717('0x5f')]&&fs['existsSync'](path[_0x2717('0x64')](config['root'],_0x3daa46,_[_0x2717('0x66')](_0x4122bd[_0x2717('0x5f')])))?path[_0x2717('0x64')](config['root'],_0x3daa46,_[_0x2717('0x66')](_0x4122bd['favicon'])):path[_0x2717('0x64')](config['root'],_0x3daa46,_[_0x2717('0x66')](_0x2717('0x77')));var _0x2d02ca=_0x2717('0x68')+_[_0x2717('0x69')](_0x2717('0x5f'));if(_0x4122bd[_0x2d02ca]||!_0x40e8f4[_0x2717('0x6a')]){_0x19b411=path[_0x2717('0x64')](config[_0x2717('0x65')],_0x3daa46,_[_0x2717('0x66')](_0x2717('0x77')));}if(!fs['existsSync'](_0x19b411)){throw new db[(_0x2717('0x6c'))][(_0x2717('0x6f'))](_[_0x2717('0x69')](_0x2717('0x5f'))+_0x2717('0x6d'));}return _0x4783dd['download'](_0x19b411);}})[_0x2717('0x51')](handleError(_0x4783dd,null));};exports[_0x2717('0x78')]=function(_0x3c99f6,_0x599beb){var _0x3ffa1d={'offset':moment()[_0x2717('0x79')]()};_0x3ffa1d[_0x2717('0x7a')]=moment()[_0x2717('0x79')](_0x3ffa1d[_0x2717('0x2b')])[_0x2717('0x7b')](_0x2717('0x7c'));return _0x599beb['status'](0xc8)[_0x2717('0x7d')](_0x3ffa1d);};