3605b8c07f1c0762edb132e024db7c95dc134822
[motion2.git] / server / api / sound / 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 _0xd8c9=['now','post','single','put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./sound.controller','get','/:id','isAuthenticated','download','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','extname'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xd8c9,0xc3));var _0x9d8c=function(_0xe1e236,_0x2aa415){_0xe1e236=_0xe1e236-0x0;var _0x1855f3=_0xd8c9[_0xe1e236];return _0x1855f3;};'use strict';var multer=require(_0x9d8c('0x0'));var util=require(_0x9d8c('0x1'));var path=require(_0x9d8c('0x2'));var timeout=require(_0x9d8c('0x3'));var express=require(_0x9d8c('0x4'));var router=express[_0x9d8c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9d8c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9d8c('0x7'));var controller=require(_0x9d8c('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x9d8c('0x9')](_0x9d8c('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x9d8c('0x9')]('/:id/download',auth[_0x9d8c('0xb')](),controller[_0x9d8c('0xc')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x377af4,_0x13efe0,_0x693b70){_0x693b70(null,path[_0x9d8c('0xd')](config[_0x9d8c('0xe')],_0x9d8c('0xf')));},'filename':function(_0x728776,_0x6fc417,_0x3c10da){_0x6fc417[_0x9d8c('0x10')]=_0x6fc417[_0x9d8c('0x10')][_0x9d8c('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3c10da(null,util[_0x9d8c('0x12')](_0x9d8c('0x13'),path['basename'](_0x6fc417['originalname'],path[_0x9d8c('0x14')](_0x6fc417[_0x9d8c('0x10')])),Date[_0x9d8c('0x15')](),path[_0x9d8c('0x14')](_0x6fc417[_0x9d8c('0x10')])));}})});router[_0x9d8c('0x16')]('/',upload[_0x9d8c('0x17')]('file'),controller['create']);router[_0x9d8c('0x18')](_0x9d8c('0xa'),auth[_0x9d8c('0xb')](),controller[_0x9d8c('0x19')]);router[_0x9d8c('0x1a')](_0x9d8c('0xa'),auth[_0x9d8c('0xb')](),controller[_0x9d8c('0x1a')]);module['exports']=router;