aboutsummaryrefslogtreecommitdiffhomepage
path: root/controllers/api/v1/remoteVideos.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-02-07 11:23:23 +0100
committerChocobozzz <florian.bigard@gmail.com>2016-02-07 11:23:23 +0100
commit9f10b2928df655c3672d9607e864e667d4bc903a (patch)
tree7743911b974b3a7fb0d4c7cec2a723942466b7f1 /controllers/api/v1/remoteVideos.js
parentd7c01e7793d813d804a3b5716d8288f9dcf71a16 (diff)
downloadPeerTube-9f10b2928df655c3672d9607e864e667d4bc903a.tar.gz
PeerTube-9f10b2928df655c3672d9607e864e667d4bc903a.tar.zst
PeerTube-9f10b2928df655c3672d9607e864e667d4bc903a.zip
Remove useless anonymous functions of files
Diffstat (limited to 'controllers/api/v1/remoteVideos.js')
-rw-r--r--controllers/api/v1/remoteVideos.js82
1 files changed, 40 insertions, 42 deletions
diff --git a/controllers/api/v1/remoteVideos.js b/controllers/api/v1/remoteVideos.js
index 58bb5f3cb..475a874cf 100644
--- a/controllers/api/v1/remoteVideos.js
+++ b/controllers/api/v1/remoteVideos.js
@@ -1,55 +1,53 @@
1;(function () { 1'use strict'
2 'use strict'
3 2
4 var express = require('express') 3var express = require('express')
5 var pluck = require('lodash-node/compat/collection/pluck') 4var pluck = require('lodash-node/compat/collection/pluck')
6 5
7 var middleware = require('../../../middlewares') 6var middleware = require('../../../middlewares')
8 var secureMiddleware = middleware.secure 7var secureMiddleware = middleware.secure
9 var cacheMiddleware = middleware.cache 8var cacheMiddleware = middleware.cache
10 var reqValidator = middleware.reqValidators.remote 9var reqValidator = middleware.reqValidators.remote
11 var videos = require('../../../models/videos') 10var videos = require('../../../models/videos')
12 11
13 var router = express.Router() 12var router = express.Router()
14 13
15 router.post('/add', 14router.post('/add',
16 reqValidator.secureRequest, 15 reqValidator.secureRequest,
17 secureMiddleware.decryptBody, 16 secureMiddleware.decryptBody,
18 reqValidator.remoteVideosAdd, 17 reqValidator.remoteVideosAdd,
19 cacheMiddleware.cache(false), 18 cacheMiddleware.cache(false),
20 addRemoteVideos 19 addRemoteVideos
21 ) 20)
22 21
23 router.post('/remove', 22router.post('/remove',
24 reqValidator.secureRequest, 23 reqValidator.secureRequest,
25 secureMiddleware.decryptBody, 24 secureMiddleware.decryptBody,
26 reqValidator.remoteVideosRemove, 25 reqValidator.remoteVideosRemove,
27 cacheMiddleware.cache(false), 26 cacheMiddleware.cache(false),
28 removeRemoteVideo 27 removeRemoteVideo
29 ) 28)
30 29
31 // --------------------------------------------------------------------------- 30// ---------------------------------------------------------------------------
32 31
33 module.exports = router 32module.exports = router
34 33
35 // --------------------------------------------------------------------------- 34// ---------------------------------------------------------------------------
36 35
37 function addRemoteVideos (req, res, next) { 36function addRemoteVideos (req, res, next) {
38 videos.addRemotes(req.body.data, function (err, videos) { 37 videos.addRemotes(req.body.data, function (err, videos) {
39 if (err) return next(err) 38 if (err) return next(err)
40 39
41 res.json(videos) 40 res.json(videos)
42 }) 41 })
43 } 42}
44 43
45 function removeRemoteVideo (req, res, next) { 44function removeRemoteVideo (req, res, next) {
46 var url = req.body.signature.url 45 var url = req.body.signature.url
47 var magnetUris = pluck(req.body.data, 'magnetUri') 46 var magnetUris = pluck(req.body.data, 'magnetUri')
48 47
49 videos.removeRemotesOfByMagnetUris(url, magnetUris, function (err) { 48 videos.removeRemotesOfByMagnetUris(url, magnetUris, function (err) {
50 if (err) return next(err) 49 if (err) return next(err)
51 50
52 res.sendStatus(204) 51 res.sendStatus(204)
53 }) 52 })
54 } 53}
55})()