7999e392edcb41b981b5b78f70324081e2abdf80
[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 _0x2d17=['connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','index','webhookGet','/:id','show','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','post','file','/webhook','put','isAuthenticated','delete','exports','multer','util'];(function(_0x11c95b,_0x34a06f){var _0x2fbe8d=function(_0x26a18e){while(--_0x26a18e){_0x11c95b['push'](_0x11c95b['shift']());}};_0x2fbe8d(++_0x34a06f);}(_0x2d17,0x17e));var _0x72d1=function(_0x2bcddc,_0x16e51f){_0x2bcddc=_0x2bcddc-0x0;var _0x2198ee=_0x2d17[_0x2bcddc];return _0x2198ee;};'use strict';var multer=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var path=require('path');var timeout=require(_0x72d1('0x2'));var express=require(_0x72d1('0x3'));var router=express['Router']();var fs_extra=require(_0x72d1('0x4'));var auth=require(_0x72d1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x72d1('0x6'));var controller=require('./plugin.controller');router[_0x72d1('0x7')]('/',auth['isAuthenticated'](),controller[_0x72d1('0x8')]);router[_0x72d1('0x7')]('/webhook',controller[_0x72d1('0x9')]);router[_0x72d1('0x7')](_0x72d1('0xa'),auth['isAuthenticated'](),controller[_0x72d1('0xb')]);router[_0x72d1('0x7')](_0x72d1('0xc'),auth['isAuthenticated'](),controller[_0x72d1('0xd')]);var upload=multer({'storage':multer[_0x72d1('0xe')]({'destination':function(_0x45eb4a,_0x14a41e,_0x3cb9c2){_0x3cb9c2(null,path[_0x72d1('0xf')](config[_0x72d1('0x10')],_0x72d1('0x11')));},'filename':function(_0x273ccf,_0x2f5a78,_0x5ad4df){_0x2f5a78[_0x72d1('0x12')]=_0x2f5a78[_0x72d1('0x12')][_0x72d1('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5ad4df(null,util[_0x72d1('0x14')](_0x72d1('0x15'),path[_0x72d1('0x16')](_0x2f5a78[_0x72d1('0x12')],path[_0x72d1('0x17')](_0x2f5a78[_0x72d1('0x12')])),Date[_0x72d1('0x18')](),path[_0x72d1('0x17')](_0x2f5a78[_0x72d1('0x12')])));}})});router[_0x72d1('0x19')]('/',upload['single'](_0x72d1('0x1a')),controller['upload']);router[_0x72d1('0x19')](_0x72d1('0x1b'),controller['webhookPost']);router[_0x72d1('0x1c')](_0x72d1('0xa'),auth[_0x72d1('0x1d')](),controller['update']);router['delete'](_0x72d1('0xa'),auth[_0x72d1('0x1d')](),controller[_0x72d1('0x1e')]);module[_0x72d1('0x1f')]=router;