diff options
Diffstat (limited to 'routes/api')
-rw-r--r-- | routes/api/v1/remoteVideos.js | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/routes/api/v1/remoteVideos.js b/routes/api/v1/remoteVideos.js index 10793b2b4..a104113b2 100644 --- a/routes/api/v1/remoteVideos.js +++ b/routes/api/v1/remoteVideos.js | |||
@@ -3,21 +3,23 @@ | |||
3 | 3 | ||
4 | var express = require('express') | 4 | var express = require('express') |
5 | var router = express.Router() | 5 | var router = express.Router() |
6 | var pluck = require('lodash-node/compat/collection/pluck') | ||
7 | |||
6 | var middleware = require('../../../middlewares') | 8 | var middleware = require('../../../middlewares') |
7 | var miscMiddleware = middleware.misc | 9 | var miscMiddleware = middleware.misc |
8 | var reqValidator = middleware.reqValidators.remote | 10 | var reqValidator = middleware.reqValidators.remote |
9 | var videos = require('../../../src/videos') | 11 | var videos = require('../../../src/videos') |
10 | 12 | ||
11 | function addRemoteVideos (req, res, next) { | 13 | function addRemoteVideos (req, res, next) { |
12 | videos.addRemote(req.body.data, function (err, video) { | 14 | videos.addRemotes(req.body.data, function (err, videos) { |
13 | if (err) return next(err) | 15 | if (err) return next(err) |
14 | 16 | ||
15 | res.json(video) | 17 | res.json(videos) |
16 | }) | 18 | }) |
17 | } | 19 | } |
18 | 20 | ||
19 | function removeRemoteVideo (req, res, next) { | 21 | function removeRemoteVideo (req, res, next) { |
20 | videos.removeRemote(req.body.signature.url, req.body.data.magnetUri, function (err) { | 22 | videos.removeRemotes(req.body.signature.url, pluck(req.body.data, 'magnetUri'), function (err) { |
21 | if (err) return next(err) | 23 | if (err) return next(err) |
22 | 24 | ||
23 | res.status(204) | 25 | res.status(204) |