b13b21bd10ce123066e4f814c0f6fec96d25a218
[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 _0x561d=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./sound.controller','get','isAuthenticated','/:id','show','/:id/download','diskStorage','join','root','server/files/sounds/original/','originalname','format','basename','extname','now','post','single','file','create','put','update','delete'];(function(_0x1fea1f,_0x397c41){var _0x21cc19=function(_0x158219){while(--_0x158219){_0x1fea1f['push'](_0x1fea1f['shift']());}};_0x21cc19(++_0x397c41);}(_0x561d,0x105));var _0xd561=function(_0x158cfb,_0x2e87b6){_0x158cfb=_0x158cfb-0x0;var _0x4e8dcf=_0x561d[_0x158cfb];return _0x4e8dcf;};'use strict';var multer=require('multer');var util=require(_0xd561('0x0'));var path=require(_0xd561('0x1'));var timeout=require(_0xd561('0x2'));var express=require(_0xd561('0x3'));var router=express[_0xd561('0x4')]();var auth=require(_0xd561('0x5'));var interaction=require(_0xd561('0x6'));var config=require('../../config/environment');var controller=require(_0xd561('0x7'));router[_0xd561('0x8')]('/',auth[_0xd561('0x9')](),controller['index']);router[_0xd561('0x8')](_0xd561('0xa'),auth[_0xd561('0x9')](),controller[_0xd561('0xb')]);router[_0xd561('0x8')](_0xd561('0xc'),auth[_0xd561('0x9')](),controller['download']);var upload=multer({'storage':multer[_0xd561('0xd')]({'destination':function(_0x592a77,_0x5088d2,_0xdebc2d){_0xdebc2d(null,path[_0xd561('0xe')](config[_0xd561('0xf')],_0xd561('0x10')));},'filename':function(_0x3b47bc,_0x3f4f35,_0x51ac82){_0x3f4f35['originalname']=_0x3f4f35[_0xd561('0x11')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x51ac82(null,util[_0xd561('0x12')]('%s-%s%s',path[_0xd561('0x13')](_0x3f4f35['originalname'],path[_0xd561('0x14')](_0x3f4f35[_0xd561('0x11')])),Date[_0xd561('0x15')](),path[_0xd561('0x14')](_0x3f4f35[_0xd561('0x11')])));}})});router[_0xd561('0x16')]('/',upload[_0xd561('0x17')](_0xd561('0x18')),controller[_0xd561('0x19')]);router[_0xd561('0x1a')](_0xd561('0xa'),auth['isAuthenticated'](),controller[_0xd561('0x1b')]);router[_0xd561('0x1c')]('/:id',auth[_0xd561('0x9')](),controller['delete']);module['exports']=router;