e30eb7144694cf1e960fd3db950ba8d65fd22d10
[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 _0x99e9=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','isAuthenticated','index','get','/webhook','/:id','show','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','replace','format','%s-%s%s','post','single','file','upload','update','delete'];(function(_0x3f00a7,_0x359027){var _0x496533=function(_0x2a40b6){while(--_0x2a40b6){_0x3f00a7['push'](_0x3f00a7['shift']());}};_0x496533(++_0x359027);}(_0x99e9,0xb4));var _0x999e=function(_0x40b3f2,_0x2c4f5f){_0x40b3f2=_0x40b3f2-0x0;var _0x4ce90c=_0x99e9[_0x40b3f2];return _0x4ce90c;};'use strict';var multer=require('multer');var util=require(_0x999e('0x0'));var path=require(_0x999e('0x1'));var timeout=require(_0x999e('0x2'));var express=require(_0x999e('0x3'));var router=express['Router']();var fs_extra=require(_0x999e('0x4'));var auth=require(_0x999e('0x5'));var interaction=require(_0x999e('0x6'));var config=require('../../config/environment');var controller=require(_0x999e('0x7'));router['get']('/',auth[_0x999e('0x8')](),controller[_0x999e('0x9')]);router[_0x999e('0xa')](_0x999e('0xb'),controller['webhookGet']);router[_0x999e('0xa')](_0x999e('0xc'),auth[_0x999e('0x8')](),controller[_0x999e('0xd')]);router[_0x999e('0xa')](_0x999e('0xe'),auth[_0x999e('0x8')](),controller[_0x999e('0xf')]);var upload=multer({'storage':multer[_0x999e('0x10')]({'destination':function(_0xf40130,_0x9368cf,_0x1d19b0){_0x1d19b0(null,path[_0x999e('0x11')](config[_0x999e('0x12')],_0x999e('0x13')));},'filename':function(_0xdb587b,_0x26b55a,_0x47a3c1){_0x26b55a[_0x999e('0x14')]=_0x26b55a['originalname'][_0x999e('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x47a3c1(null,util[_0x999e('0x16')](_0x999e('0x17'),path['basename'](_0x26b55a[_0x999e('0x14')],path['extname'](_0x26b55a[_0x999e('0x14')])),Date['now'](),path['extname'](_0x26b55a[_0x999e('0x14')])));}})});router[_0x999e('0x18')]('/',upload[_0x999e('0x19')](_0x999e('0x1a')),controller[_0x999e('0x1b')]);router[_0x999e('0x18')]('/webhook',controller['webhookPost']);router['put'](_0x999e('0xc'),auth[_0x999e('0x8')](),controller[_0x999e('0x1c')]);router[_0x999e('0x1d')](_0x999e('0xc'),auth[_0x999e('0x8')](),controller['delete']);module['exports']=router;