52140439970c47257fe957ef35e756bf35a5759c
[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 _0x7708=['originalname','replace','format','extname','post','single','file','create','put','/:id','update','delete','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','diskStorage','join','root','server/files/sounds/original/'];(function(_0x29605b,_0x621c8f){var _0x20f00f=function(_0x41e1d0){while(--_0x41e1d0){_0x29605b['push'](_0x29605b['shift']());}};_0x20f00f(++_0x621c8f);}(_0x7708,0x9e));var _0x8770=function(_0x56756b,_0x3e8cc7){_0x56756b=_0x56756b-0x0;var _0xa3002=_0x7708[_0x56756b];return _0xa3002;};'use strict';var multer=require(_0x8770('0x0'));var util=require(_0x8770('0x1'));var path=require(_0x8770('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8770('0x3')]();var fs_extra=require(_0x8770('0x4'));var auth=require(_0x8770('0x5'));var interaction=require(_0x8770('0x6'));var config=require(_0x8770('0x7'));var controller=require(_0x8770('0x8'));router[_0x8770('0x9')]('/',auth[_0x8770('0xa')](),controller[_0x8770('0xb')]);router[_0x8770('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['get']('/:id/download',auth[_0x8770('0xa')](),controller['download']);var upload=multer({'storage':multer[_0x8770('0xc')]({'destination':function(_0x3bd39f,_0x4fb0e0,_0x54eecd){_0x54eecd(null,path[_0x8770('0xd')](config[_0x8770('0xe')],_0x8770('0xf')));},'filename':function(_0x4bd7d3,_0x2631a,_0x1a1dd6){_0x2631a[_0x8770('0x10')]=_0x2631a[_0x8770('0x10')][_0x8770('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1a1dd6(null,util[_0x8770('0x12')]('%s-%s%s',path['basename'](_0x2631a[_0x8770('0x10')],path[_0x8770('0x13')](_0x2631a[_0x8770('0x10')])),Date['now'](),path['extname'](_0x2631a[_0x8770('0x10')])));}})});router[_0x8770('0x14')]('/',upload[_0x8770('0x15')](_0x8770('0x16')),controller[_0x8770('0x17')]);router[_0x8770('0x18')](_0x8770('0x19'),auth[_0x8770('0xa')](),controller[_0x8770('0x1a')]);router[_0x8770('0x1b')](_0x8770('0x19'),auth['isAuthenticated'](),controller[_0x8770('0x1b')]);module[_0x8770('0x1c')]=router;