b5a6f8995506e6cbf0579a8fd7b8045f26ead017
[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 _0x008c=['/:id','/:id/download','join','root','server/files/plugins','originalname','format','basename','extname','now','single','file','upload','post','update','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','webhookGet'];(function(_0x14b9da,_0x45fe0b){var _0x5e1924=function(_0x7f0f0f){while(--_0x7f0f0f){_0x14b9da['push'](_0x14b9da['shift']());}};_0x5e1924(++_0x45fe0b);}(_0x008c,0x188));var _0xc008=function(_0xf93076,_0x1acb30){_0xf93076=_0xf93076-0x0;var _0x33d1da=_0x008c[_0xf93076];return _0x33d1da;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/webhook',controller[_0xc008('0xd')]);router['get'](_0xc008('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xc008('0xa')](_0xc008('0xf'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1eacfa,_0xc881aa,_0x5b2004){_0x5b2004(null,path[_0xc008('0x10')](config[_0xc008('0x11')],_0xc008('0x12')));},'filename':function(_0x2a5b4e,_0x9ffa93,_0x1819c6){_0x9ffa93[_0xc008('0x13')]=_0x9ffa93['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1819c6(null,util[_0xc008('0x14')]('%s-%s%s',path[_0xc008('0x15')](_0x9ffa93[_0xc008('0x13')],path[_0xc008('0x16')](_0x9ffa93[_0xc008('0x13')])),Date[_0xc008('0x17')](),path['extname'](_0x9ffa93['originalname'])));}})});router['post']('/',upload[_0xc008('0x18')](_0xc008('0x19')),controller[_0xc008('0x1a')]);router[_0xc008('0x1b')]('/webhook',controller['webhookPost']);router['put']('/:id',auth[_0xc008('0xb')](),controller[_0xc008('0x1c')]);router['delete'](_0xc008('0xe'),auth['isAuthenticated'](),controller['delete']);module['exports']=router;