eca327759d473dcf42119a5a18d7e504076e78d8
[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 _0x9b9b=['single','file','webhookPost','put','delete','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','/:id/download','download','root','server/files/plugins','originalname','format','basename','extname','now','post'];(function(_0x472351,_0x272e77){var _0x104310=function(_0x16b897){while(--_0x16b897){_0x472351['push'](_0x472351['shift']());}};_0x104310(++_0x272e77);}(_0x9b9b,0x114));var _0xb9b9=function(_0xcf098d,_0x1b9e69){_0xcf098d=_0xcf098d-0x0;var _0x99daff=_0x9b9b[_0xcf098d];return _0x99daff;};'use strict';var multer=require('multer');var util=require(_0xb9b9('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb9b9('0x1'));var router=express[_0xb9b9('0x2')]();var fs_extra=require(_0xb9b9('0x3'));var auth=require(_0xb9b9('0x4'));var interaction=require(_0xb9b9('0x5'));var config=require(_0xb9b9('0x6'));var controller=require(_0xb9b9('0x7'));router[_0xb9b9('0x8')]('/',auth[_0xb9b9('0x9')](),controller[_0xb9b9('0xa')]);router[_0xb9b9('0x8')](_0xb9b9('0xb'),controller[_0xb9b9('0xc')]);router[_0xb9b9('0x8')](_0xb9b9('0xd'),auth[_0xb9b9('0x9')](),controller['show']);router['get'](_0xb9b9('0xe'),auth[_0xb9b9('0x9')](),controller[_0xb9b9('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3949d0,_0x3b6bb9,_0x1122bb){_0x1122bb(null,path['join'](config[_0xb9b9('0x10')],_0xb9b9('0x11')));},'filename':function(_0xbc5a42,_0x26fa04,_0x230fea){_0x26fa04[_0xb9b9('0x12')]=_0x26fa04['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x230fea(null,util[_0xb9b9('0x13')]('%s-%s%s',path[_0xb9b9('0x14')](_0x26fa04['originalname'],path[_0xb9b9('0x15')](_0x26fa04[_0xb9b9('0x12')])),Date[_0xb9b9('0x16')](),path[_0xb9b9('0x15')](_0x26fa04[_0xb9b9('0x12')])));}})});router[_0xb9b9('0x17')]('/',upload[_0xb9b9('0x18')](_0xb9b9('0x19')),controller['upload']);router[_0xb9b9('0x17')]('/webhook',controller[_0xb9b9('0x1a')]);router[_0xb9b9('0x1b')](_0xb9b9('0xd'),auth[_0xb9b9('0x9')](),controller['update']);router[_0xb9b9('0x1c')](_0xb9b9('0xd'),auth[_0xb9b9('0x9')](),controller[_0xb9b9('0x1c')]);module[_0xb9b9('0x1d')]=router;