Built motion from commit c738b9ac.|2.6.25
[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 _0xb332=['server/files/plugins','originalname','replace','format','basename','extname','now','post','single','file','upload','/:id','delete','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','/:id/download','download','diskStorage','join','root'];(function(_0x352588,_0x19b360){var _0x2c8775=function(_0xd44f4e){while(--_0xd44f4e){_0x352588['push'](_0x352588['shift']());}};_0x2c8775(++_0x19b360);}(_0xb332,0xd9));var _0x2b33=function(_0x2b0a86,_0x2ecebd){_0x2b0a86=_0x2b0a86-0x0;var _0x955940=_0xb332[_0x2b0a86];return _0x955940;};'use strict';var multer=require(_0x2b33('0x0'));var util=require('util');var path=require(_0x2b33('0x1'));var timeout=require(_0x2b33('0x2'));var express=require('express');var router=express[_0x2b33('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2b33('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2b33('0x5'));var controller=require('./plugin.controller');router[_0x2b33('0x6')]('/',auth[_0x2b33('0x7')](),controller[_0x2b33('0x8')]);router[_0x2b33('0x6')]('/webhook',controller['webhookGet']);router[_0x2b33('0x6')]('/:id',auth[_0x2b33('0x7')](),controller[_0x2b33('0x9')]);router[_0x2b33('0x6')](_0x2b33('0xa'),auth['isAuthenticated'](),controller[_0x2b33('0xb')]);var upload=multer({'storage':multer[_0x2b33('0xc')]({'destination':function(_0x1be19d,_0x1d83a6,_0x1989f3){_0x1989f3(null,path[_0x2b33('0xd')](config[_0x2b33('0xe')],_0x2b33('0xf')));},'filename':function(_0x1e0d36,_0x3969cb,_0xca2248){_0x3969cb['originalname']=_0x3969cb[_0x2b33('0x10')][_0x2b33('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xca2248(null,util[_0x2b33('0x12')]('%s-%s%s',path[_0x2b33('0x13')](_0x3969cb['originalname'],path[_0x2b33('0x14')](_0x3969cb[_0x2b33('0x10')])),Date[_0x2b33('0x15')](),path['extname'](_0x3969cb['originalname'])));}})});router[_0x2b33('0x16')]('/',upload[_0x2b33('0x17')](_0x2b33('0x18')),controller[_0x2b33('0x19')]);router[_0x2b33('0x16')]('/webhook',controller['webhookPost']);router['put'](_0x2b33('0x1a'),auth['isAuthenticated'](),controller['update']);router[_0x2b33('0x1b')](_0x2b33('0x1a'),auth[_0x2b33('0x7')](),controller['delete']);module[_0x2b33('0x1c')]=router;