diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-01-31 11:23:52 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-01-31 11:23:52 +0100 |
commit | c45f7f84001c2731909db04dd82e1c1f290386eb (patch) | |
tree | b7e57420a1f65dfbbacc1a532bf489c9bea6125d /controllers/api/v1/remoteVideos.js | |
parent | cda021079ff455cc0fd0eb95a5395fa808ab63d1 (diff) | |
download | PeerTube-c45f7f84001c2731909db04dd82e1c1f290386eb.tar.gz PeerTube-c45f7f84001c2731909db04dd82e1c1f290386eb.tar.zst PeerTube-c45f7f84001c2731909db04dd82e1c1f290386eb.zip |
Infile code reorganization
Diffstat (limited to 'controllers/api/v1/remoteVideos.js')
-rw-r--r-- | controllers/api/v1/remoteVideos.js | 30 |
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 | })() |