Built motion from commit 497d3d92.|2.5.43
[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 _0x50a6=['../../components/auth/service','../../components/interaction/service','./plugin.controller','index','get','/webhook','webhookGet','/:id','show','isAuthenticated','download','root','originalname','format','%s-%s%s','basename','extname','post','single','file','put','update','delete','exports','multer','util','express','fs-extra'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x50a6,0xa4));var _0x650a=function(_0x57014b,_0x360c0f){_0x57014b=_0x57014b-0x0;var _0x2b258a=_0x50a6[_0x57014b];return _0x2b258a;};'use strict';var multer=require(_0x650a('0x0'));var util=require(_0x650a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x650a('0x2'));var router=express['Router']();var fs_extra=require(_0x650a('0x3'));var auth=require(_0x650a('0x4'));var interaction=require(_0x650a('0x5'));var config=require('../../config/environment');var controller=require(_0x650a('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x650a('0x7')]);router[_0x650a('0x8')](_0x650a('0x9'),controller[_0x650a('0xa')]);router['get'](_0x650a('0xb'),auth['isAuthenticated'](),controller[_0x650a('0xc')]);router[_0x650a('0x8')]('/:id/download',auth[_0x650a('0xd')](),controller[_0x650a('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3e2406,_0x526881,_0x142cdb){_0x142cdb(null,path['join'](config[_0x650a('0xf')],'server/files/plugins'));},'filename':function(_0x2f8bf8,_0x48077a,_0x33e73d){_0x48077a[_0x650a('0x10')]=_0x48077a[_0x650a('0x10')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x33e73d(null,util[_0x650a('0x11')](_0x650a('0x12'),path[_0x650a('0x13')](_0x48077a[_0x650a('0x10')],path[_0x650a('0x14')](_0x48077a[_0x650a('0x10')])),Date['now'](),path[_0x650a('0x14')](_0x48077a['originalname'])));}})});router[_0x650a('0x15')]('/',upload[_0x650a('0x16')](_0x650a('0x17')),controller['upload']);router['post']('/webhook',controller['webhookPost']);router[_0x650a('0x18')](_0x650a('0xb'),auth[_0x650a('0xd')](),controller[_0x650a('0x19')]);router[_0x650a('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0x650a('0x1a')]);module[_0x650a('0x1b')]=router;