Built motion from commit ffdca78c.|2.6.24
[motion2.git] / server / api / chatWebsite / index.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 _0xc6dd=['getApplications','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','post','addDisposition','diskStorage','join','root','server/files/images/logos/','format','now','single','file','addLogo','%s-%s','originalname','/:id/avatar','addAvatar','server/files/images/avatars/','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','addInteraction','/:id/proactive_actions','addProactiveActions','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','exports','util','path','express','Router','../../config/environment','./chatWebsite.controller','get','/describe','isAuthenticated','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','/:id/snippet','getSnippet','/:id/applications'];(function(_0x2e3f29,_0x2fc512){var _0x203ffb=function(_0x277893){while(--_0x277893){_0x2e3f29['push'](_0x2e3f29['shift']());}};_0x203ffb(++_0x2fc512);}(_0xc6dd,0xf6));var _0xdc6d=function(_0x5a260d,_0x3018ed){_0x5a260d=_0x5a260d-0x0;var _0x404d96=_0xc6dd[_0x5a260d];return _0x404d96;};'use strict';var multer=require('multer');var util=require(_0xdc6d('0x0'));var path=require(_0xdc6d('0x1'));var timeout=require('connect-timeout');var express=require(_0xdc6d('0x2'));var router=express[_0xdc6d('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdc6d('0x4'));var controller=require(_0xdc6d('0x5'));router[_0xdc6d('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xdc6d('0x6')](_0xdc6d('0x7'),auth[_0xdc6d('0x8')](),controller['describe']);router[_0xdc6d('0x6')]('/:id',auth[_0xdc6d('0x8')](),controller[_0xdc6d('0x9')]);router[_0xdc6d('0x6')](_0xdc6d('0xa'),auth[_0xdc6d('0x8')](),controller['getDispositions']);router[_0xdc6d('0x6')](_0xdc6d('0xb'),auth[_0xdc6d('0x8')](),controller[_0xdc6d('0xc')]);router[_0xdc6d('0x6')](_0xdc6d('0xd'),controller[_0xdc6d('0xe')]);router[_0xdc6d('0x6')]('/:id/avatar',controller[_0xdc6d('0xf')]);router[_0xdc6d('0x6')](_0xdc6d('0x10'),controller[_0xdc6d('0x11')]);router['get'](_0xdc6d('0x12'),controller['getSystemAvatar']);router['get']('/:id/interactions',auth[_0xdc6d('0x8')](),controller['getInteractions']);router[_0xdc6d('0x6')](_0xdc6d('0x13'),controller[_0xdc6d('0x14')]);router['get'](_0xdc6d('0x15'),auth[_0xdc6d('0x8')](),controller[_0xdc6d('0x16')]);router[_0xdc6d('0x6')]('/:id/proactive_actions',auth[_0xdc6d('0x8')](),controller[_0xdc6d('0x17')]);router['get'](_0xdc6d('0x18'),controller[_0xdc6d('0x19')]);router[_0xdc6d('0x6')](_0xdc6d('0x1a'),auth['isAuthenticated'](),controller[_0xdc6d('0x1b')]);router[_0xdc6d('0x6')](_0xdc6d('0x1c'),auth['isAuthenticated'](),controller['getAgents']);router[_0xdc6d('0x1d')]('/',auth[_0xdc6d('0x8')](),controller['create']);router['post'](_0xdc6d('0xa'),auth[_0xdc6d('0x8')](),controller[_0xdc6d('0x1e')]);router[_0xdc6d('0x1d')](_0xdc6d('0xb'),auth[_0xdc6d('0x8')](),controller['addAnswer']);var upload=multer({'storage':multer[_0xdc6d('0x1f')]({'destination':function(_0x31ffb6,_0x16e508,_0x596b19){_0x596b19(null,path[_0xdc6d('0x20')](config[_0xdc6d('0x21')],_0xdc6d('0x22')));},'filename':function(_0x4c951a,_0x1e2197,_0x3f93b3){_0x3f93b3(null,util[_0xdc6d('0x23')]('%s-%s',Date[_0xdc6d('0x24')](),_0x1e2197['originalname']));}})});router['post'](_0xdc6d('0xd'),upload[_0xdc6d('0x25')](_0xdc6d('0x26')),controller[_0xdc6d('0x27')]);var upload=multer({'storage':multer[_0xdc6d('0x1f')]({'destination':function(_0x41e1a5,_0xba6cca,_0x3f9735){_0x3f9735(null,path[_0xdc6d('0x20')](config[_0xdc6d('0x21')],'server/files/images/avatars/'));},'filename':function(_0x2a08b2,_0x3c0eeb,_0x5106e9){_0x5106e9(null,util[_0xdc6d('0x23')](_0xdc6d('0x28'),Date[_0xdc6d('0x24')](),_0x3c0eeb[_0xdc6d('0x29')]));}})});router[_0xdc6d('0x1d')](_0xdc6d('0x2a'),upload['single']('file'),controller[_0xdc6d('0x2b')]);var upload=multer({'storage':multer[_0xdc6d('0x1f')]({'destination':function(_0x107a0d,_0x461a67,_0x3e6236){_0x3e6236(null,path[_0xdc6d('0x20')](config[_0xdc6d('0x21')],_0xdc6d('0x2c')));},'filename':function(_0x1e00c0,_0x1443b4,_0x3b4fd5){_0x3b4fd5(null,util[_0xdc6d('0x23')](_0xdc6d('0x28'),Date[_0xdc6d('0x24')](),_0x1443b4[_0xdc6d('0x29')]));}})});router[_0xdc6d('0x1d')](_0xdc6d('0x10'),upload[_0xdc6d('0x25')](_0xdc6d('0x26')),controller[_0xdc6d('0x2d')]);var upload=multer({'storage':multer[_0xdc6d('0x1f')]({'destination':function(_0x2cfbfe,_0x3f1971,_0x52dc8c){_0x52dc8c(null,path[_0xdc6d('0x20')](config[_0xdc6d('0x21')],_0xdc6d('0x2c')));},'filename':function(_0x1de703,_0x49f3cf,_0x40074f){_0x40074f(null,util['format'](_0xdc6d('0x28'),Date[_0xdc6d('0x24')](),_0x49f3cf['originalname']));}})});router[_0xdc6d('0x1d')]('/:id/system_avatar',upload['single'](_0xdc6d('0x26')),controller[_0xdc6d('0x2e')]);router[_0xdc6d('0x1d')](_0xdc6d('0x2f'),controller[_0xdc6d('0x30')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0xb4b474,_0x38d640,_0x3127d6){const _0x5b23b4=path[_0xdc6d('0x20')](config[_0xdc6d('0x21')],_0xdc6d('0x31'),_0xdc6d('0x32'),_0xdc6d('0x33'));fs_extra[_0xdc6d('0x34')](_0x5b23b4,function(){_0x3127d6(null,_0x5b23b4);});},'filename':function(_0x12ea20,_0xe2ac26,_0x255778){const _0x9a4589=_0xe2ac26[_0xdc6d('0x29')][_0xdc6d('0x35')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x4cb25e=path[_0xdc6d('0x36')](_0x9a4589);const _0x30fbd1=Date[_0xdc6d('0x24')]()+'-'+_0x9a4589[_0xdc6d('0x35')](_0x4cb25e,'')+_0x4cb25e;_0x255778(null,_0x30fbd1);}})});router[_0xdc6d('0x1d')](_0xdc6d('0x37'),offlineUploadMulter['any'](),controller['offline']);router[_0xdc6d('0x1d')]('/:id/interactions',auth['isAuthenticated'](),controller[_0xdc6d('0x38')]);router[_0xdc6d('0x1d')](_0xdc6d('0x15'),auth[_0xdc6d('0x8')](),controller['addApplications']);router[_0xdc6d('0x1d')](_0xdc6d('0x39'),auth[_0xdc6d('0x8')](),controller[_0xdc6d('0x3a')]);router[_0xdc6d('0x1d')](_0xdc6d('0x1c'),auth[_0xdc6d('0x8')](),controller[_0xdc6d('0x3b')]);router[_0xdc6d('0x3c')]('/:id',auth[_0xdc6d('0x8')](),controller[_0xdc6d('0x3d')]);router[_0xdc6d('0x3e')]('/:id',auth[_0xdc6d('0x8')](),controller[_0xdc6d('0x3f')]);router[_0xdc6d('0x3e')](_0xdc6d('0xa'),auth['isAuthenticated'](),controller[_0xdc6d('0x40')]);router['delete'](_0xdc6d('0xb'),auth[_0xdc6d('0x8')](),controller['removeAnswers']);router[_0xdc6d('0x3e')](_0xdc6d('0x1c'),auth[_0xdc6d('0x8')](),controller[_0xdc6d('0x41')]);module[_0xdc6d('0x42')]=router;