Built motion from commit 67e5df37.|2.0.68
[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 _0x2e9b=['upload','put','/:id','update','delete','exports','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','webhookGet','show','/:id/download','download','diskStorage','root','server/files/plugins','originalname','format','extname','now','post'];(function(_0x50d759,_0x3083b7){var _0x37b5e9=function(_0x309d45){while(--_0x309d45){_0x50d759['push'](_0x50d759['shift']());}};_0x37b5e9(++_0x3083b7);}(_0x2e9b,0x124));var _0xb2e9=function(_0x28a2e7,_0x3765d7){_0x28a2e7=_0x28a2e7-0x0;var _0x157881=_0x2e9b[_0x28a2e7];return _0x157881;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var express=require(_0xb2e9('0x0'));var router=express[_0xb2e9('0x1')]();var auth=require(_0xb2e9('0x2'));var interaction=require(_0xb2e9('0x3'));var config=require(_0xb2e9('0x4'));var controller=require('./plugin.controller');router['get']('/',auth[_0xb2e9('0x5')](),controller[_0xb2e9('0x6')]);router[_0xb2e9('0x7')]('/webhook',controller[_0xb2e9('0x8')]);router['get']('/:id',auth[_0xb2e9('0x5')](),controller[_0xb2e9('0x9')]);router['get'](_0xb2e9('0xa'),auth[_0xb2e9('0x5')](),controller[_0xb2e9('0xb')]);var upload=multer({'storage':multer[_0xb2e9('0xc')]({'destination':function(_0x32cdca,_0x412ca4,_0x149fb1){_0x149fb1(null,path['join'](config[_0xb2e9('0xd')],_0xb2e9('0xe')));},'filename':function(_0x13ddd5,_0x1ce3b7,_0x33cbed){_0x1ce3b7[_0xb2e9('0xf')]=_0x1ce3b7[_0xb2e9('0xf')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x33cbed(null,util[_0xb2e9('0x10')]('%s-%s%s',path['basename'](_0x1ce3b7[_0xb2e9('0xf')],path[_0xb2e9('0x11')](_0x1ce3b7[_0xb2e9('0xf')])),Date[_0xb2e9('0x12')](),path[_0xb2e9('0x11')](_0x1ce3b7[_0xb2e9('0xf')])));}})});router[_0xb2e9('0x13')]('/',upload['single']('file'),controller[_0xb2e9('0x14')]);router[_0xb2e9('0x13')]('/webhook',controller['webhookPost']);router[_0xb2e9('0x15')](_0xb2e9('0x16'),auth[_0xb2e9('0x5')](),controller[_0xb2e9('0x17')]);router['delete']('/:id',auth[_0xb2e9('0x5')](),controller[_0xb2e9('0x18')]);module[_0xb2e9('0x19')]=router;