Built motion from commit (unavailable).|2.4.16
[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 _0xed73=['../../components/interaction/service','../../config/environment','./plugin.controller','get','index','/webhook','webhookGet','/:id','download','diskStorage','join','originalname','replace','format','basename','now','single','file','upload','post','delete','exports','multer','path','express','Router','../../components/auth/service'];(function(_0x5f25b3,_0x35481a){var _0x4ab9bf=function(_0x49baf7){while(--_0x49baf7){_0x5f25b3['push'](_0x5f25b3['shift']());}};_0x4ab9bf(++_0x35481a);}(_0xed73,0x67));var _0x3ed7=function(_0xdd8002,_0x547e4d){_0xdd8002=_0xdd8002-0x0;var _0x55e7e9=_0xed73[_0xdd8002];return _0x55e7e9;};'use strict';var multer=require(_0x3ed7('0x0'));var util=require('util');var path=require(_0x3ed7('0x1'));var timeout=require('connect-timeout');var express=require(_0x3ed7('0x2'));var router=express[_0x3ed7('0x3')]();var auth=require(_0x3ed7('0x4'));var interaction=require(_0x3ed7('0x5'));var config=require(_0x3ed7('0x6'));var controller=require(_0x3ed7('0x7'));router[_0x3ed7('0x8')]('/',auth['isAuthenticated'](),controller[_0x3ed7('0x9')]);router[_0x3ed7('0x8')](_0x3ed7('0xa'),controller[_0x3ed7('0xb')]);router[_0x3ed7('0x8')](_0x3ed7('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x3ed7('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x3ed7('0xd')]);var upload=multer({'storage':multer[_0x3ed7('0xe')]({'destination':function(_0x501a17,_0x574bf3,_0x5f1389){_0x5f1389(null,path[_0x3ed7('0xf')](config['root'],'server/files/plugins'));},'filename':function(_0x469521,_0x683420,_0x5426c8){_0x683420[_0x3ed7('0x10')]=_0x683420[_0x3ed7('0x10')][_0x3ed7('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5426c8(null,util[_0x3ed7('0x12')]('%s-%s%s',path[_0x3ed7('0x13')](_0x683420[_0x3ed7('0x10')],path['extname'](_0x683420[_0x3ed7('0x10')])),Date[_0x3ed7('0x14')](),path['extname'](_0x683420[_0x3ed7('0x10')])));}})});router['post']('/',upload[_0x3ed7('0x15')](_0x3ed7('0x16')),controller[_0x3ed7('0x17')]);router[_0x3ed7('0x18')]('/webhook',controller['webhookPost']);router['put'](_0x3ed7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x3ed7('0x19')](_0x3ed7('0xc'),auth['isAuthenticated'](),controller[_0x3ed7('0x19')]);module[_0x3ed7('0x1a')]=router;