07d2eca05cfd6a79a796d50f9007c135e505030f
[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 _0x7bae=['../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','show','/:id/download','download','diskStorage','join','root','originalname','replace','format','%s-%s%s','extname','now','upload','update','delete','exports','path','connect-timeout','Router','../../components/auth/service'];(function(_0x5dc927,_0x49f4a1){var _0x416440=function(_0x752837){while(--_0x752837){_0x5dc927['push'](_0x5dc927['shift']());}};_0x416440(++_0x49f4a1);}(_0x7bae,0x13b));var _0xe7ba=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x7bae[_0x2dea24];return _0x309d58;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7ba('0x0'));var timeout=require(_0xe7ba('0x1'));var express=require('express');var router=express[_0xe7ba('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xe7ba('0x3'));var interaction=require(_0xe7ba('0x4'));var config=require(_0xe7ba('0x5'));var controller=require(_0xe7ba('0x6'));router[_0xe7ba('0x7')]('/',auth[_0xe7ba('0x8')](),controller[_0xe7ba('0x9')]);router[_0xe7ba('0x7')](_0xe7ba('0xa'),controller[_0xe7ba('0xb')]);router[_0xe7ba('0x7')](_0xe7ba('0xc'),auth[_0xe7ba('0x8')](),controller[_0xe7ba('0xd')]);router['get'](_0xe7ba('0xe'),auth[_0xe7ba('0x8')](),controller[_0xe7ba('0xf')]);var upload=multer({'storage':multer[_0xe7ba('0x10')]({'destination':function(_0x15083a,_0x1672f0,_0x99a86f){_0x99a86f(null,path[_0xe7ba('0x11')](config[_0xe7ba('0x12')],'server/files/plugins'));},'filename':function(_0xf4fcb0,_0x588c8b,_0x602b1){_0x588c8b[_0xe7ba('0x13')]=_0x588c8b[_0xe7ba('0x13')][_0xe7ba('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x602b1(null,util[_0xe7ba('0x15')](_0xe7ba('0x16'),path['basename'](_0x588c8b['originalname'],path[_0xe7ba('0x17')](_0x588c8b[_0xe7ba('0x13')])),Date[_0xe7ba('0x18')](),path['extname'](_0x588c8b[_0xe7ba('0x13')])));}})});router['post']('/',upload['single']('file'),controller[_0xe7ba('0x19')]);router['post'](_0xe7ba('0xa'),controller['webhookPost']);router['put']('/:id',auth[_0xe7ba('0x8')](),controller[_0xe7ba('0x1a')]);router[_0xe7ba('0x1b')](_0xe7ba('0xc'),auth[_0xe7ba('0x8')](),controller['delete']);module[_0xe7ba('0x1c')]=router;