Built motion from commit 06eb8eb0.|2.6.31
[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 _0xcf80=['%s-%s%s','basename','extname','update','delete','multer','util','path','express','Router','fs-extra','../../config/environment','./sound.controller','index','get','/:id','isAuthenticated','download','diskStorage','join','server/files/sounds/original/','originalname','replace','format'];(function(_0x48c9b6,_0x2f1e05){var _0x1e4e00=function(_0x3501f7){while(--_0x3501f7){_0x48c9b6['push'](_0x48c9b6['shift']());}};_0x1e4e00(++_0x2f1e05);}(_0xcf80,0x1cd));var _0x0cf8=function(_0x392d32,_0x313d5e){_0x392d32=_0x392d32-0x0;var _0x2701ad=_0xcf80[_0x392d32];return _0x2701ad;};'use strict';var multer=require(_0x0cf8('0x0'));var util=require(_0x0cf8('0x1'));var path=require(_0x0cf8('0x2'));var timeout=require('connect-timeout');var express=require(_0x0cf8('0x3'));var router=express[_0x0cf8('0x4')]();var fs_extra=require(_0x0cf8('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0cf8('0x6'));var controller=require(_0x0cf8('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x0cf8('0x8')]);router[_0x0cf8('0x9')](_0x0cf8('0xa'),auth[_0x0cf8('0xb')](),controller['show']);router[_0x0cf8('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0x0cf8('0xc')]);var upload=multer({'storage':multer[_0x0cf8('0xd')]({'destination':function(_0x35e681,_0x14022f,_0x21a350){_0x21a350(null,path[_0x0cf8('0xe')](config['root'],_0x0cf8('0xf')));},'filename':function(_0x1779a5,_0x7070ba,_0x3ba7c4){_0x7070ba[_0x0cf8('0x10')]=_0x7070ba[_0x0cf8('0x10')][_0x0cf8('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3ba7c4(null,util[_0x0cf8('0x12')](_0x0cf8('0x13'),path[_0x0cf8('0x14')](_0x7070ba[_0x0cf8('0x10')],path[_0x0cf8('0x15')](_0x7070ba[_0x0cf8('0x10')])),Date['now'](),path[_0x0cf8('0x15')](_0x7070ba[_0x0cf8('0x10')])));}})});router['post']('/',upload['single']('file'),controller['create']);router['put'](_0x0cf8('0xa'),auth['isAuthenticated'](),controller[_0x0cf8('0x16')]);router[_0x0cf8('0x17')]('/:id',auth[_0x0cf8('0xb')](),controller[_0x0cf8('0x17')]);module['exports']=router;