dd813e6c9ed525f43d3ab5d1f3ba417c3c54c5a4
[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 _0xf021=['server/files/plugins','originalname','basename','extname','now','post','file','put','delete','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','get','/webhook','webhookGet','/:id','show','download','diskStorage','root'];(function(_0x4aeb5a,_0x56ef9e){var _0x2ec1a2=function(_0x4bfaad){while(--_0x4bfaad){_0x4aeb5a['push'](_0x4aeb5a['shift']());}};_0x2ec1a2(++_0x56ef9e);}(_0xf021,0x18f));var _0x1f02=function(_0x1f0f2a,_0x14f11a){_0x1f0f2a=_0x1f0f2a-0x0;var _0x145cd9=_0xf021[_0x1f0f2a];return _0x145cd9;};'use strict';var multer=require(_0x1f02('0x0'));var util=require(_0x1f02('0x1'));var path=require(_0x1f02('0x2'));var timeout=require(_0x1f02('0x3'));var express=require(_0x1f02('0x4'));var router=express['Router']();var fs_extra=require(_0x1f02('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1f02('0x6'));var config=require(_0x1f02('0x7'));var controller=require('./plugin.controller');router['get']('/',auth[_0x1f02('0x8')](),controller['index']);router[_0x1f02('0x9')](_0x1f02('0xa'),controller[_0x1f02('0xb')]);router[_0x1f02('0x9')](_0x1f02('0xc'),auth['isAuthenticated'](),controller[_0x1f02('0xd')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x1f02('0xe')]);var upload=multer({'storage':multer[_0x1f02('0xf')]({'destination':function(_0x1a93ec,_0x19ee35,_0x3c2b15){_0x3c2b15(null,path['join'](config[_0x1f02('0x10')],_0x1f02('0x11')));},'filename':function(_0x204e17,_0x56a2c2,_0x24e9b8){_0x56a2c2[_0x1f02('0x12')]=_0x56a2c2[_0x1f02('0x12')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x24e9b8(null,util['format']('%s-%s%s',path[_0x1f02('0x13')](_0x56a2c2[_0x1f02('0x12')],path[_0x1f02('0x14')](_0x56a2c2[_0x1f02('0x12')])),Date[_0x1f02('0x15')](),path[_0x1f02('0x14')](_0x56a2c2[_0x1f02('0x12')])));}})});router[_0x1f02('0x16')]('/',upload['single'](_0x1f02('0x17')),controller['upload']);router['post']('/webhook',controller['webhookPost']);router[_0x1f02('0x18')](_0x1f02('0xc'),auth[_0x1f02('0x8')](),controller['update']);router[_0x1f02('0x19')](_0x1f02('0xc'),auth[_0x1f02('0x8')](),controller[_0x1f02('0x19')]);module['exports']=router;