aboutsummaryrefslogtreecommitdiffhomepage
path: root/controllers/api/v1/remoteVideos.js
diff options
context:
space:
mode:
Diffstat (limited to 'controllers/api/v1/remoteVideos.js')
-rw-r--r--controllers/api/v1/remoteVideos.js30
1 files changed, 24 insertions, 6 deletions
diff --git a/controllers/api/v1/remoteVideos.js b/controllers/api/v1/remoteVideos.js
index d534d6792..2be2fc87e 100644
--- a/controllers/api/v1/remoteVideos.js
+++ b/controllers/api/v1/remoteVideos.js
@@ -2,7 +2,6 @@
2 'use strict' 2 'use strict'
3 3
4 var express = require('express') 4 var express = require('express')
5 var router = express.Router()
6 var pluck = require('lodash-node/compat/collection/pluck') 5 var pluck = require('lodash-node/compat/collection/pluck')
7 6
8 var middleware = require('../../../middlewares') 7 var middleware = require('../../../middlewares')
@@ -10,6 +9,30 @@
10 var reqValidator = middleware.reqValidators.remote 9 var reqValidator = middleware.reqValidators.remote
11 var videos = require('../../../models/videos') 10 var videos = require('../../../models/videos')
12 11
12 var router = express.Router()
13
14 router.post('/add',
15 reqValidator.secureRequest,
16 miscMiddleware.decryptBody,
17 reqValidator.remoteVideosAdd,
18 miscMiddleware.cache(false),
19 addRemoteVideos
20 )
21
22 router.post('/remove',
23 reqValidator.secureRequest,
24 miscMiddleware.decryptBody,
25 reqValidator.remoteVideosRemove,
26 miscMiddleware.cache(false),
27 removeRemoteVideo
28 )
29
30 // ---------------------------------------------------------------------------
31
32 module.exports = router
33
34 // ---------------------------------------------------------------------------
35
13 function addRemoteVideos (req, res, next) { 36 function addRemoteVideos (req, res, next) {
14 videos.addRemotes(req.body.data, function (err, videos) { 37 videos.addRemotes(req.body.data, function (err, videos) {
15 if (err) return next(err) 38 if (err) return next(err)
@@ -25,9 +48,4 @@
25 res.sendStatus(204) 48 res.sendStatus(204)
26 }) 49 })
27 } 50 }
28
29 router.post('/add', reqValidator.secureRequest, miscMiddleware.decryptBody, reqValidator.remoteVideosAdd, miscMiddleware.cache(false), addRemoteVideos)
30 router.post('/remove', reqValidator.secureRequest, miscMiddleware.decryptBody, reqValidator.remoteVideosRemove, miscMiddleware.cache(false), removeRemoteVideo)
31
32 module.exports = router
33})() 51})()