Built motion from commit 85328c08.|2.5.50
[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 _0x0c02=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/:id','show','/:id/download','join','root','server/files/plugins','replace','format','%s-%s%s','basename','originalname','extname','now','post','single','file','upload','/webhook','update','delete','exports'];(function(_0xa26d73,_0x5b221d){var _0x52f1c3=function(_0xff7d2){while(--_0xff7d2){_0xa26d73['push'](_0xa26d73['shift']());}};_0x52f1c3(++_0x5b221d);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x20c0('0x0'));var path=require(_0x20c0('0x1'));var timeout=require('connect-timeout');var express=require(_0x20c0('0x2'));var router=express[_0x20c0('0x3')]();var fs_extra=require(_0x20c0('0x4'));var auth=require(_0x20c0('0x5'));var interaction=require(_0x20c0('0x6'));var config=require(_0x20c0('0x7'));var controller=require(_0x20c0('0x8'));router[_0x20c0('0x9')]('/',auth[_0x20c0('0xa')](),controller[_0x20c0('0xb')]);router['get']('/webhook',controller['webhookGet']);router['get'](_0x20c0('0xc'),auth[_0x20c0('0xa')](),controller[_0x20c0('0xd')]);router[_0x20c0('0x9')](_0x20c0('0xe'),auth[_0x20c0('0xa')](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x52eb0d,_0x578592,_0x56770a){_0x56770a(null,path[_0x20c0('0xf')](config[_0x20c0('0x10')],_0x20c0('0x11')));},'filename':function(_0x207b1e,_0x4ed79e,_0x56fa09){_0x4ed79e['originalname']=_0x4ed79e['originalname'][_0x20c0('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x56fa09(null,util[_0x20c0('0x13')](_0x20c0('0x14'),path[_0x20c0('0x15')](_0x4ed79e[_0x20c0('0x16')],path[_0x20c0('0x17')](_0x4ed79e[_0x20c0('0x16')])),Date[_0x20c0('0x18')](),path[_0x20c0('0x17')](_0x4ed79e['originalname'])));}})});router[_0x20c0('0x19')]('/',upload[_0x20c0('0x1a')](_0x20c0('0x1b')),controller[_0x20c0('0x1c')]);router[_0x20c0('0x19')](_0x20c0('0x1d'),controller['webhookPost']);router['put']('/:id',auth[_0x20c0('0xa')](),controller[_0x20c0('0x1e')]);router[_0x20c0('0x1f')](_0x20c0('0xc'),auth['isAuthenticated'](),controller[_0x20c0('0x1f')]);module[_0x20c0('0x20')]=router;