53ea2162e56e7e00956ddd9c8f5630f8e08bb75e
[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 _0x509f=['/:id','delete','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','show','download','diskStorage','join','root','server/files/sounds/original/','originalname','%s-%s%s','basename','extname','post','single','file','create','put'];(function(_0x218f88,_0x43b7c8){var _0x4c7b6d=function(_0x546396){while(--_0x546396){_0x218f88['push'](_0x218f88['shift']());}};_0x4c7b6d(++_0x43b7c8);}(_0x509f,0x1b5));var _0xf509=function(_0x3d716b,_0x4af1f3){_0x3d716b=_0x3d716b-0x0;var _0x29f0eb=_0x509f[_0x3d716b];return _0x29f0eb;};'use strict';var multer=require('multer');var util=require(_0xf509('0x0'));var path=require(_0xf509('0x1'));var timeout=require(_0xf509('0x2'));var express=require('express');var router=express[_0xf509('0x3')]();var fs_extra=require(_0xf509('0x4'));var auth=require(_0xf509('0x5'));var interaction=require(_0xf509('0x6'));var config=require(_0xf509('0x7'));var controller=require(_0xf509('0x8'));router[_0xf509('0x9')]('/',auth[_0xf509('0xa')](),controller[_0xf509('0xb')]);router[_0xf509('0x9')]('/:id',auth[_0xf509('0xa')](),controller[_0xf509('0xc')]);router[_0xf509('0x9')]('/:id/download',auth[_0xf509('0xa')](),controller[_0xf509('0xd')]);var upload=multer({'storage':multer[_0xf509('0xe')]({'destination':function(_0x53b571,_0x2d4262,_0x339c52){_0x339c52(null,path[_0xf509('0xf')](config[_0xf509('0x10')],_0xf509('0x11')));},'filename':function(_0x459536,_0x8ce56e,_0x4da390){_0x8ce56e[_0xf509('0x12')]=_0x8ce56e[_0xf509('0x12')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4da390(null,util['format'](_0xf509('0x13'),path[_0xf509('0x14')](_0x8ce56e[_0xf509('0x12')],path['extname'](_0x8ce56e[_0xf509('0x12')])),Date['now'](),path[_0xf509('0x15')](_0x8ce56e[_0xf509('0x12')])));}})});router[_0xf509('0x16')]('/',upload[_0xf509('0x17')](_0xf509('0x18')),controller[_0xf509('0x19')]);router[_0xf509('0x1a')](_0xf509('0x1b'),auth[_0xf509('0xa')](),controller['update']);router[_0xf509('0x1c')](_0xf509('0x1b'),auth['isAuthenticated'](),controller[_0xf509('0x1c')]);module['exports']=router;