Built motion from commit 52c8a02d.|2.6.29
[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 _0x5178=['root','server/files/plugins','originalname','replace','format','basename','extname','now','post','single','file','upload','webhookPost','put','/:id','update','delete','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','index','/webhook','webhookGet','isAuthenticated','/:id/download','diskStorage','join'];(function(_0x5bce83,_0x36dc56){var _0x2fefd1=function(_0x336a09){while(--_0x336a09){_0x5bce83['push'](_0x5bce83['shift']());}};_0x2fefd1(++_0x36dc56);}(_0x5178,0x171));var _0x8517=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x5178[_0x6131cd];return _0x47e916;};'use strict';var multer=require('multer');var util=require(_0x8517('0x0'));var path=require(_0x8517('0x1'));var timeout=require(_0x8517('0x2'));var express=require(_0x8517('0x3'));var router=express[_0x8517('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8517('0x5'));var config=require(_0x8517('0x6'));var controller=require('./plugin.controller');router[_0x8517('0x7')]('/',auth['isAuthenticated'](),controller[_0x8517('0x8')]);router[_0x8517('0x7')](_0x8517('0x9'),controller[_0x8517('0xa')]);router[_0x8517('0x7')]('/:id',auth[_0x8517('0xb')](),controller['show']);router['get'](_0x8517('0xc'),auth[_0x8517('0xb')](),controller['download']);var upload=multer({'storage':multer[_0x8517('0xd')]({'destination':function(_0x24172f,_0x203154,_0x3be6b0){_0x3be6b0(null,path[_0x8517('0xe')](config[_0x8517('0xf')],_0x8517('0x10')));},'filename':function(_0x12388f,_0x4b9768,_0x9c57de){_0x4b9768[_0x8517('0x11')]=_0x4b9768[_0x8517('0x11')][_0x8517('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x9c57de(null,util[_0x8517('0x13')]('%s-%s%s',path[_0x8517('0x14')](_0x4b9768[_0x8517('0x11')],path[_0x8517('0x15')](_0x4b9768[_0x8517('0x11')])),Date[_0x8517('0x16')](),path[_0x8517('0x15')](_0x4b9768[_0x8517('0x11')])));}})});router[_0x8517('0x17')]('/',upload[_0x8517('0x18')](_0x8517('0x19')),controller[_0x8517('0x1a')]);router[_0x8517('0x17')]('/webhook',controller[_0x8517('0x1b')]);router[_0x8517('0x1c')](_0x8517('0x1d'),auth[_0x8517('0xb')](),controller[_0x8517('0x1e')]);router[_0x8517('0x1f')](_0x8517('0x1d'),auth['isAuthenticated'](),controller[_0x8517('0x1f')]);module['exports']=router;