Built motion from commit 67e5df37.|2.0.66
[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 _0x91a7=['single','file','webhook','put','delete','exports','util','path','express','../../components/auth/service','../../config/environment','isAuthenticated','index','/:id','show','get','download','diskStorage','join','root','originalname','replace','basename','now','post'];(function(_0x5d7b1d,_0x16e2d9){var _0x1c41c1=function(_0x42770c){while(--_0x42770c){_0x5d7b1d['push'](_0x5d7b1d['shift']());}};_0x1c41c1(++_0x16e2d9);}(_0x91a7,0xe7));var _0x791a=function(_0x52d7df,_0x5d5742){_0x52d7df=_0x52d7df-0x0;var _0x6163fc=_0x91a7[_0x52d7df];return _0x6163fc;};'use strict';var multer=require('multer');var util=require(_0x791a('0x0'));var path=require(_0x791a('0x1'));var express=require(_0x791a('0x2'));var router=express['Router']();var auth=require(_0x791a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x791a('0x4'));var controller=require('./plugin.controller');router['get']('/',auth[_0x791a('0x5')](),controller[_0x791a('0x6')]);router['get'](_0x791a('0x7'),auth['isAuthenticated'](),controller[_0x791a('0x8')]);router[_0x791a('0x9')]('/:id/download',auth[_0x791a('0x5')](),controller[_0x791a('0xa')]);var upload=multer({'storage':multer[_0x791a('0xb')]({'destination':function(_0x80ff65,_0x266e4b,_0x5249d5){_0x5249d5(null,path[_0x791a('0xc')](config[_0x791a('0xd')],'server/files/plugins'));},'filename':function(_0x2bd26a,_0x206eea,_0x167bc4){_0x206eea[_0x791a('0xe')]=_0x206eea[_0x791a('0xe')][_0x791a('0xf')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x167bc4(null,util['format']('%s-%s%s',path[_0x791a('0x10')](_0x206eea[_0x791a('0xe')],path['extname'](_0x206eea[_0x791a('0xe')])),Date[_0x791a('0x11')](),path['extname'](_0x206eea[_0x791a('0xe')])));}})});router[_0x791a('0x12')]('/',upload[_0x791a('0x13')](_0x791a('0x14')),controller['upload']);router[_0x791a('0x12')]('/webhook',controller[_0x791a('0x15')]);router[_0x791a('0x16')]('/:id',auth[_0x791a('0x5')](),controller['update']);router[_0x791a('0x17')]('/:id',auth['isAuthenticated'](),controller['delete']);module[_0x791a('0x18')]=router;