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.js53
1 files changed, 0 insertions, 53 deletions
diff --git a/controllers/api/v1/remoteVideos.js b/controllers/api/v1/remoteVideos.js
deleted file mode 100644
index 475a874cf..000000000
--- a/controllers/api/v1/remoteVideos.js
+++ /dev/null
@@ -1,53 +0,0 @@
1'use strict'
2
3var express = require('express')
4var pluck = require('lodash-node/compat/collection/pluck')
5
6var middleware = require('../../../middlewares')
7var secureMiddleware = middleware.secure
8var cacheMiddleware = middleware.cache
9var reqValidator = middleware.reqValidators.remote
10var videos = require('../../../models/videos')
11
12var router = express.Router()
13
14router.post('/add',
15 reqValidator.secureRequest,
16 secureMiddleware.decryptBody,
17 reqValidator.remoteVideosAdd,
18 cacheMiddleware.cache(false),
19 addRemoteVideos
20)
21
22router.post('/remove',
23 reqValidator.secureRequest,
24 secureMiddleware.decryptBody,
25 reqValidator.remoteVideosRemove,
26 cacheMiddleware.cache(false),
27 removeRemoteVideo
28)
29
30// ---------------------------------------------------------------------------
31
32module.exports = router
33
34// ---------------------------------------------------------------------------
35
36function addRemoteVideos (req, res, next) {
37 videos.addRemotes(req.body.data, function (err, videos) {
38 if (err) return next(err)
39
40 res.json(videos)
41 })
42}
43
44function removeRemoteVideo (req, res, next) {
45 var url = req.body.signature.url
46 var magnetUris = pluck(req.body.data, 'magnetUri')
47
48 videos.removeRemotesOfByMagnetUris(url, magnetUris, function (err) {
49 if (err) return next(err)
50
51 res.sendStatus(204)
52 })
53}