2e6bf2ec1d991816d6cf89f28518589b39e5a348
[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 _0x70e0=['delete','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','isAuthenticated','webhookGet','get','/:id','show','/:id/download','diskStorage','join','root','server/files/plugins','originalname','format','extname','post','single','file','/webhook','webhookPost','put'];(function(_0x1e4c37,_0xdf253e){var _0xec3469=function(_0x169c0e){while(--_0x169c0e){_0x1e4c37['push'](_0x1e4c37['shift']());}};_0xec3469(++_0xdf253e);}(_0x70e0,0x17b));var _0x070e=function(_0x4dcbe3,_0x52fd65){_0x4dcbe3=_0x4dcbe3-0x0;var _0x3dd8c5=_0x70e0[_0x4dcbe3];return _0x3dd8c5;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');var controller=require(_0x070e('0x7'));router['get']('/',auth[_0x070e('0x8')](),controller['index']);router['get']('/webhook',controller[_0x070e('0x9')]);router[_0x070e('0xa')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xc')]);router[_0x070e('0xa')](_0x070e('0xd'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0x070e('0xe')]({'destination':function(_0x2e3e5e,_0x12bb37,_0xb8d819){_0xb8d819(null,path[_0x070e('0xf')](config[_0x070e('0x10')],_0x070e('0x11')));},'filename':function(_0x1baa12,_0x39d2b9,_0x5bf079){_0x39d2b9[_0x070e('0x12')]=_0x39d2b9['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5bf079(null,util[_0x070e('0x13')]('%s-%s%s',path['basename'](_0x39d2b9['originalname'],path[_0x070e('0x14')](_0x39d2b9[_0x070e('0x12')])),Date['now'](),path['extname'](_0x39d2b9[_0x070e('0x12')])));}})});router[_0x070e('0x15')]('/',upload[_0x070e('0x16')](_0x070e('0x17')),controller['upload']);router['post'](_0x070e('0x18'),controller[_0x070e('0x19')]);router[_0x070e('0x1a')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller['update']);router[_0x070e('0x1b')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x1b')]);module[_0x070e('0x1c')]=router;