aboutsummaryrefslogtreecommitdiffhomepage
path: root/controllers/api/v1/remoteVideos.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-03-07 11:33:59 +0100
committerChocobozzz <florian.bigard@gmail.com>2016-03-07 11:33:59 +0100
commitb9a3e09ad5a7673f64556d1dba122ed4c4fac980 (patch)
tree66d4928b82af19a2372a2505822233884f3fd471 /controllers/api/v1/remoteVideos.js
parentb2ff5e3e686eb552c5ccd64ce67b0455972ceef0 (diff)
downloadPeerTube-b9a3e09ad5a7673f64556d1dba122ed4c4fac980.tar.gz
PeerTube-b9a3e09ad5a7673f64556d1dba122ed4c4fac980.tar.zst
PeerTube-b9a3e09ad5a7673f64556d1dba122ed4c4fac980.zip
Prepare folders structure for angular app
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}