Built motion from commit (unavailable).|2.5.29
[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 _0xae09=['Router','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','/:id','show','download','diskStorage','join','root','originalname','replace','format','basename','now','extname','file','post','webhookPost','delete','exports','multer','path','express'];(function(_0x55ca9f,_0x2753d3){var _0x13712c=function(_0xe1a7b0){while(--_0xe1a7b0){_0x55ca9f['push'](_0x55ca9f['shift']());}};_0x13712c(++_0x2753d3);}(_0xae09,0x89));var _0x9ae0=function(_0x517b49,_0x346ec4){_0x517b49=_0x517b49-0x0;var _0xf78d50=_0xae09[_0x517b49];return _0xf78d50;};'use strict';var multer=require(_0x9ae0('0x0'));var util=require('util');var path=require(_0x9ae0('0x1'));var timeout=require('connect-timeout');var express=require(_0x9ae0('0x2'));var router=express[_0x9ae0('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9ae0('0x4'));var config=require(_0x9ae0('0x5'));var controller=require(_0x9ae0('0x6'));router[_0x9ae0('0x7')]('/',auth[_0x9ae0('0x8')](),controller[_0x9ae0('0x9')]);router['get'](_0x9ae0('0xa'),controller['webhookGet']);router[_0x9ae0('0x7')](_0x9ae0('0xb'),auth[_0x9ae0('0x8')](),controller[_0x9ae0('0xc')]);router[_0x9ae0('0x7')]('/:id/download',auth[_0x9ae0('0x8')](),controller[_0x9ae0('0xd')]);var upload=multer({'storage':multer[_0x9ae0('0xe')]({'destination':function(_0x1c5b03,_0x2c3f1f,_0x19ffe7){_0x19ffe7(null,path[_0x9ae0('0xf')](config[_0x9ae0('0x10')],'server/files/plugins'));},'filename':function(_0x57ca2d,_0x2418ab,_0x2b42cb){_0x2418ab[_0x9ae0('0x11')]=_0x2418ab['originalname'][_0x9ae0('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2b42cb(null,util[_0x9ae0('0x13')]('%s-%s%s',path[_0x9ae0('0x14')](_0x2418ab[_0x9ae0('0x11')],path['extname'](_0x2418ab[_0x9ae0('0x11')])),Date[_0x9ae0('0x15')](),path[_0x9ae0('0x16')](_0x2418ab[_0x9ae0('0x11')])));}})});router['post']('/',upload['single'](_0x9ae0('0x17')),controller['upload']);router[_0x9ae0('0x18')](_0x9ae0('0xa'),controller[_0x9ae0('0x19')]);router['put'](_0x9ae0('0xb'),auth[_0x9ae0('0x8')](),controller['update']);router[_0x9ae0('0x1a')](_0x9ae0('0xb'),auth['isAuthenticated'](),controller[_0x9ae0('0x1a')]);module[_0x9ae0('0x1b')]=router;