Built motion from commit 43538d75.|2.5.35
[motion2.git] / server / api / plugin / 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 _0x4b19=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','get','index','webhookGet','/:id','show','isAuthenticated','download','diskStorage','root','server/files/plugins','originalname','replace','basename','post','single','file','/webhook','webhookPost','put','update','delete','multer'];(function(_0x2cde0a,_0x1f9695){var _0x260610=function(_0x179089){while(--_0x179089){_0x2cde0a['push'](_0x2cde0a['shift']());}};_0x260610(++_0x1f9695);}(_0x4b19,0x195));var _0x94b1=function(_0x3a874a,_0x886045){_0x3a874a=_0x3a874a-0x0;var _0x503bfe=_0x4b19[_0x3a874a];return _0x503bfe;};'use strict';var multer=require(_0x94b1('0x0'));var util=require('util');var path=require(_0x94b1('0x1'));var timeout=require(_0x94b1('0x2'));var express=require(_0x94b1('0x3'));var router=express['Router']();var fs_extra=require(_0x94b1('0x4'));var auth=require(_0x94b1('0x5'));var interaction=require(_0x94b1('0x6'));var config=require('../../config/environment');var controller=require(_0x94b1('0x7'));router[_0x94b1('0x8')]('/',auth['isAuthenticated'](),controller[_0x94b1('0x9')]);router[_0x94b1('0x8')]('/webhook',controller[_0x94b1('0xa')]);router[_0x94b1('0x8')](_0x94b1('0xb'),auth['isAuthenticated'](),controller[_0x94b1('0xc')]);router['get']('/:id/download',auth[_0x94b1('0xd')](),controller[_0x94b1('0xe')]);var upload=multer({'storage':multer[_0x94b1('0xf')]({'destination':function(_0x8ddf47,_0x162995,_0x3aeb91){_0x3aeb91(null,path['join'](config[_0x94b1('0x10')],_0x94b1('0x11')));},'filename':function(_0x340a29,_0x2b378c,_0x5cbf96){_0x2b378c['originalname']=_0x2b378c[_0x94b1('0x12')][_0x94b1('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5cbf96(null,util['format']('%s-%s%s',path[_0x94b1('0x14')](_0x2b378c[_0x94b1('0x12')],path['extname'](_0x2b378c[_0x94b1('0x12')])),Date['now'](),path['extname'](_0x2b378c[_0x94b1('0x12')])));}})});router[_0x94b1('0x15')]('/',upload[_0x94b1('0x16')](_0x94b1('0x17')),controller['upload']);router[_0x94b1('0x15')](_0x94b1('0x18'),controller[_0x94b1('0x19')]);router[_0x94b1('0x1a')](_0x94b1('0xb'),auth[_0x94b1('0xd')](),controller[_0x94b1('0x1b')]);router['delete'](_0x94b1('0xb'),auth[_0x94b1('0xd')](),controller[_0x94b1('0x1c')]);module['exports']=router;