88e755619c67054d155ca643e9dd16d8fdea1668
[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 _0x9f62=['extname','now','post','single','file','upload','put','/:id','delete','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./plugin.controller','get','index','/webhook','webhookGet','/:id/download','isAuthenticated','join','root','originalname','replace','format','%s-%s%s','basename'];(function(_0x2c984e,_0x1b76b3){var _0x2df6f9=function(_0x1cd4d6){while(--_0x1cd4d6){_0x2c984e['push'](_0x2c984e['shift']());}};_0x2df6f9(++_0x1b76b3);}(_0x9f62,0x154));var _0x29f6=function(_0x248338,_0x14dfc1){_0x248338=_0x248338-0x0;var _0x3f4ab0=_0x9f62[_0x248338];return _0x3f4ab0;};'use strict';var multer=require('multer');var util=require(_0x29f6('0x0'));var path=require('path');var timeout=require(_0x29f6('0x1'));var express=require(_0x29f6('0x2'));var router=express[_0x29f6('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x29f6('0x4'));var config=require(_0x29f6('0x5'));var controller=require(_0x29f6('0x6'));router[_0x29f6('0x7')]('/',auth['isAuthenticated'](),controller[_0x29f6('0x8')]);router[_0x29f6('0x7')](_0x29f6('0x9'),controller[_0x29f6('0xa')]);router[_0x29f6('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x29f6('0xb'),auth[_0x29f6('0xc')](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x29b3f5,_0x442623,_0x4909e0){_0x4909e0(null,path[_0x29f6('0xd')](config[_0x29f6('0xe')],'server/files/plugins'));},'filename':function(_0x5b9b6a,_0x559585,_0x57b2d2){_0x559585[_0x29f6('0xf')]=_0x559585[_0x29f6('0xf')][_0x29f6('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x57b2d2(null,util[_0x29f6('0x11')](_0x29f6('0x12'),path[_0x29f6('0x13')](_0x559585[_0x29f6('0xf')],path[_0x29f6('0x14')](_0x559585[_0x29f6('0xf')])),Date[_0x29f6('0x15')](),path[_0x29f6('0x14')](_0x559585[_0x29f6('0xf')])));}})});router[_0x29f6('0x16')]('/',upload[_0x29f6('0x17')](_0x29f6('0x18')),controller[_0x29f6('0x19')]);router[_0x29f6('0x16')]('/webhook',controller['webhookPost']);router[_0x29f6('0x1a')](_0x29f6('0x1b'),auth[_0x29f6('0xc')](),controller['update']);router[_0x29f6('0x1c')](_0x29f6('0x1b'),auth['isAuthenticated'](),controller[_0x29f6('0x1c')]);module[_0x29f6('0x1d')]=router;