5627171b645edea68f1b75a8eaeee46d4279dc78
[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 _0x303a=['show','/:id/download','download','join','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','upload','webhookPost','/:id','update','delete','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook'];(function(_0x1849b8,_0x57bbf0){var _0x37cc5f=function(_0x21c16d){while(--_0x21c16d){_0x1849b8['push'](_0x1849b8['shift']());}};_0x37cc5f(++_0x57bbf0);}(_0x303a,0x1a0));var _0xa303=function(_0x536c66,_0x570b6b){_0x536c66=_0x536c66-0x0;var _0x221d57=_0x303a[_0x536c66];return _0x221d57;};'use strict';var multer=require(_0xa303('0x0'));var util=require('util');var path=require(_0xa303('0x1'));var timeout=require(_0xa303('0x2'));var express=require(_0xa303('0x3'));var router=express[_0xa303('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa303('0x5'));var interaction=require(_0xa303('0x6'));var config=require(_0xa303('0x7'));var controller=require(_0xa303('0x8'));router[_0xa303('0x9')]('/',auth[_0xa303('0xa')](),controller[_0xa303('0xb')]);router[_0xa303('0x9')](_0xa303('0xc'),controller['webhookGet']);router['get']('/:id',auth[_0xa303('0xa')](),controller[_0xa303('0xd')]);router['get'](_0xa303('0xe'),auth['isAuthenticated'](),controller[_0xa303('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x29cd60,_0x17dfcd,_0x382cfd){_0x382cfd(null,path[_0xa303('0x10')](config['root'],_0xa303('0x11')));},'filename':function(_0x4c0169,_0xf5df1e,_0x43a054){_0xf5df1e[_0xa303('0x12')]=_0xf5df1e['originalname'][_0xa303('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x43a054(null,util[_0xa303('0x14')](_0xa303('0x15'),path[_0xa303('0x16')](_0xf5df1e[_0xa303('0x12')],path[_0xa303('0x17')](_0xf5df1e[_0xa303('0x12')])),Date[_0xa303('0x18')](),path['extname'](_0xf5df1e[_0xa303('0x12')])));}})});router[_0xa303('0x19')]('/',upload[_0xa303('0x1a')](_0xa303('0x1b')),controller[_0xa303('0x1c')]);router[_0xa303('0x19')]('/webhook',controller[_0xa303('0x1d')]);router['put'](_0xa303('0x1e'),auth['isAuthenticated'](),controller[_0xa303('0x1f')]);router['delete'](_0xa303('0x1e'),auth[_0xa303('0xa')](),controller[_0xa303('0x20')]);module['exports']=router;