Built motion from commit (unavailable).|2.5.15
[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 _0x4ebe=['util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','webhookGet','/:id','show','download','root','server/files/plugins','originalname','replace','%s-%s%s','now','post','single','file','upload','webhookPost','delete','exports','multer'];(function(_0x397b72,_0x2b533c){var _0x1c47be=function(_0x456708){while(--_0x456708){_0x397b72['push'](_0x397b72['shift']());}};_0x1c47be(++_0x2b533c);}(_0x4ebe,0x16b));var _0xe4eb=function(_0x3ad54e,_0x557792){_0x3ad54e=_0x3ad54e-0x0;var _0x3ff471=_0x4ebe[_0x3ad54e];return _0x3ff471;};'use strict';var multer=require(_0xe4eb('0x0'));var util=require(_0xe4eb('0x1'));var path=require(_0xe4eb('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe4eb('0x3')]();var auth=require(_0xe4eb('0x4'));var interaction=require(_0xe4eb('0x5'));var config=require(_0xe4eb('0x6'));var controller=require(_0xe4eb('0x7'));router[_0xe4eb('0x8')]('/',auth[_0xe4eb('0x9')](),controller[_0xe4eb('0xa')]);router[_0xe4eb('0x8')]('/webhook',controller[_0xe4eb('0xb')]);router[_0xe4eb('0x8')](_0xe4eb('0xc'),auth[_0xe4eb('0x9')](),controller[_0xe4eb('0xd')]);router[_0xe4eb('0x8')]('/:id/download',auth[_0xe4eb('0x9')](),controller[_0xe4eb('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x54875a,_0x1de6f3,_0x43fff4){_0x43fff4(null,path['join'](config[_0xe4eb('0xf')],_0xe4eb('0x10')));},'filename':function(_0x59605f,_0x2504b3,_0x21acb3){_0x2504b3['originalname']=_0x2504b3[_0xe4eb('0x11')][_0xe4eb('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x21acb3(null,util['format'](_0xe4eb('0x13'),path['basename'](_0x2504b3[_0xe4eb('0x11')],path['extname'](_0x2504b3['originalname'])),Date[_0xe4eb('0x14')](),path['extname'](_0x2504b3['originalname'])));}})});router[_0xe4eb('0x15')]('/',upload[_0xe4eb('0x16')](_0xe4eb('0x17')),controller[_0xe4eb('0x18')]);router['post']('/webhook',controller[_0xe4eb('0x19')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xe4eb('0x1a')](_0xe4eb('0xc'),auth[_0xe4eb('0x9')](),controller[_0xe4eb('0x1a')]);module[_0xe4eb('0x1b')]=router;