96b57a21e427a865b37f23f6ef28fe2141988080
[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 _0x49e2=['replace','format','basename','extname','now','post','single','file','upload','update','delete','multer','connect-timeout','../../components/auth/service','../../config/environment','./plugin.controller','get','/webhook','webhookGet','/:id','isAuthenticated','/:id/download','diskStorage','join','server/files/plugins','originalname'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x49e2,0x15d));var _0x249e=function(_0x47af41,_0x54a3c5){_0x47af41=_0x47af41-0x0;var _0x3fd879=_0x49e2[_0x47af41];return _0x3fd879;};'use strict';var multer=require(_0x249e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x249e('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x249e('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x249e('0x3'));var controller=require(_0x249e('0x4'));router[_0x249e('0x5')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x249e('0x6'),controller[_0x249e('0x7')]);router[_0x249e('0x5')](_0x249e('0x8'),auth[_0x249e('0x9')](),controller['show']);router['get'](_0x249e('0xa'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0x249e('0xb')]({'destination':function(_0x418e9d,_0x5831d4,_0x9b2d7a){_0x9b2d7a(null,path[_0x249e('0xc')](config['root'],_0x249e('0xd')));},'filename':function(_0x2d707a,_0x27a13a,_0x12cb85){_0x27a13a['originalname']=_0x27a13a[_0x249e('0xe')][_0x249e('0xf')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x12cb85(null,util[_0x249e('0x10')]('%s-%s%s',path[_0x249e('0x11')](_0x27a13a[_0x249e('0xe')],path[_0x249e('0x12')](_0x27a13a[_0x249e('0xe')])),Date[_0x249e('0x13')](),path[_0x249e('0x12')](_0x27a13a[_0x249e('0xe')])));}})});router[_0x249e('0x14')]('/',upload[_0x249e('0x15')](_0x249e('0x16')),controller[_0x249e('0x17')]);router[_0x249e('0x14')](_0x249e('0x6'),controller['webhookPost']);router['put'](_0x249e('0x8'),auth['isAuthenticated'](),controller[_0x249e('0x18')]);router[_0x249e('0x19')]('/:id',auth[_0x249e('0x9')](),controller[_0x249e('0x19')]);module['exports']=router;