Built motion from commit (unavailable).|2.4.20
[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 _0x858c=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','diskStorage','join','root','originalname','replace','%s-%s%s','basename','extname','post','single','put','/:id','delete','exports','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x858c,0x17f));var _0xc858=function(_0x52e08b,_0x13854c){_0x52e08b=_0x52e08b-0x0;var _0x28266a=_0x858c[_0x52e08b];return _0x28266a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc858('0x0'));var timeout=require(_0xc858('0x1'));var express=require(_0xc858('0x2'));var router=express[_0xc858('0x3')]();var auth=require(_0xc858('0x4'));var interaction=require(_0xc858('0x5'));var config=require(_0xc858('0x6'));var controller=require(_0xc858('0x7'));router[_0xc858('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0xc858('0x9')](),controller['show']);router[_0xc858('0x8')]('/:id/download',auth[_0xc858('0x9')](),controller['download']);var upload=multer({'storage':multer[_0xc858('0xa')]({'destination':function(_0x35d784,_0x573643,_0x198d34){_0x198d34(null,path[_0xc858('0xb')](config[_0xc858('0xc')],'server/files/sounds/original/'));},'filename':function(_0x4f7034,_0x4cc48c,_0x349dc2){_0x4cc48c[_0xc858('0xd')]=_0x4cc48c['originalname'][_0xc858('0xe')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x349dc2(null,util['format'](_0xc858('0xf'),path[_0xc858('0x10')](_0x4cc48c[_0xc858('0xd')],path[_0xc858('0x11')](_0x4cc48c[_0xc858('0xd')])),Date['now'](),path['extname'](_0x4cc48c[_0xc858('0xd')])));}})});router[_0xc858('0x12')]('/',upload[_0xc858('0x13')]('file'),controller['create']);router[_0xc858('0x14')](_0xc858('0x15'),auth[_0xc858('0x9')](),controller['update']);router[_0xc858('0x16')](_0xc858('0x15'),auth[_0xc858('0x9')](),controller[_0xc858('0x16')]);module[_0xc858('0x17')]=router;