d3593c98d064545c17f34f307c751d85d68b8bbc
[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 _0x28f2=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./plugin.controller','get','isAuthenticated','index','/webhook','show','/:id/download','download','join','server/files/plugins','originalname','replace','%s-%s%s','basename','extname','now','post','single','file','upload','webhookPost','put','/:id','delete','exports','multer','util','path'];(function(_0x454bd6,_0x5662ea){var _0x132a84=function(_0xf4b4e2){while(--_0xf4b4e2){_0x454bd6['push'](_0x454bd6['shift']());}};_0x132a84(++_0x5662ea);}(_0x28f2,0x81));var _0x228f=function(_0x23774e,_0x50bd36){_0x23774e=_0x23774e-0x0;var _0x21882f=_0x28f2[_0x23774e];return _0x21882f;};'use strict';var multer=require(_0x228f('0x0'));var util=require(_0x228f('0x1'));var path=require(_0x228f('0x2'));var timeout=require(_0x228f('0x3'));var express=require(_0x228f('0x4'));var router=express[_0x228f('0x5')]();var auth=require(_0x228f('0x6'));var interaction=require(_0x228f('0x7'));var config=require('../../config/environment');var controller=require(_0x228f('0x8'));router[_0x228f('0x9')]('/',auth[_0x228f('0xa')](),controller[_0x228f('0xb')]);router[_0x228f('0x9')](_0x228f('0xc'),controller['webhookGet']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x228f('0xd')]);router[_0x228f('0x9')](_0x228f('0xe'),auth[_0x228f('0xa')](),controller[_0x228f('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x52f37a,_0x5518c9,_0x2b34b1){_0x2b34b1(null,path[_0x228f('0x10')](config['root'],_0x228f('0x11')));},'filename':function(_0x19c6d3,_0x238507,_0x112d37){_0x238507[_0x228f('0x12')]=_0x238507[_0x228f('0x12')][_0x228f('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x112d37(null,util['format'](_0x228f('0x14'),path[_0x228f('0x15')](_0x238507['originalname'],path[_0x228f('0x16')](_0x238507['originalname'])),Date[_0x228f('0x17')](),path[_0x228f('0x16')](_0x238507[_0x228f('0x12')])));}})});router[_0x228f('0x18')]('/',upload[_0x228f('0x19')](_0x228f('0x1a')),controller[_0x228f('0x1b')]);router[_0x228f('0x18')](_0x228f('0xc'),controller[_0x228f('0x1c')]);router[_0x228f('0x1d')](_0x228f('0x1e'),auth[_0x228f('0xa')](),controller['update']);router[_0x228f('0x1f')](_0x228f('0x1e'),auth[_0x228f('0xa')](),controller[_0x228f('0x1f')]);module[_0x228f('0x20')]=router;