aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/api')
-rw-r--r--server/controllers/api/v1/pods.js8
-rw-r--r--server/controllers/api/v1/remote.js8
-rw-r--r--server/controllers/api/v1/users.js1
-rw-r--r--server/controllers/api/v1/videos.js24
4 files changed, 21 insertions, 20 deletions
diff --git a/server/controllers/api/v1/pods.js b/server/controllers/api/v1/pods.js
index 9ce8120b2..4413fbc1e 100644
--- a/server/controllers/api/v1/pods.js
+++ b/server/controllers/api/v1/pods.js
@@ -8,16 +8,16 @@ const logger = require('../../../helpers/logger')
8const friends = require('../../../lib/friends') 8const friends = require('../../../lib/friends')
9const middlewares = require('../../../middlewares') 9const middlewares = require('../../../middlewares')
10const oAuth = middlewares.oauth 10const oAuth = middlewares.oauth
11const reqValidator = middlewares.reqValidators.pods 11const validators = middlewares.validators.pods
12const signatureValidator = middlewares.reqValidators.remote.signature 12const signatureValidator = middlewares.validators.remote.signature
13 13
14const router = express.Router() 14const router = express.Router()
15const Pod = mongoose.model('Pod') 15const Pod = mongoose.model('Pod')
16const Video = mongoose.model('Video') 16const Video = mongoose.model('Video')
17 17
18router.get('/', listPodsUrl) 18router.get('/', listPodsUrl)
19router.post('/', reqValidator.podsAdd, addPods) 19router.post('/', validators.podsAdd, addPods)
20router.get('/makefriends', oAuth.authenticate, reqValidator.makeFriends, makeFriends) 20router.get('/makefriends', oAuth.authenticate, validators.makeFriends, makeFriends)
21router.get('/quitfriends', oAuth.authenticate, quitFriends) 21router.get('/quitfriends', oAuth.authenticate, quitFriends)
22// Post because this is a secured request 22// Post because this is a secured request
23router.post('/remove', signatureValidator, removePods) 23router.post('/remove', signatureValidator, removePods)
diff --git a/server/controllers/api/v1/remote.js b/server/controllers/api/v1/remote.js
index 2d71c605d..7af9b7e84 100644
--- a/server/controllers/api/v1/remote.js
+++ b/server/controllers/api/v1/remote.js
@@ -6,17 +6,17 @@ const mongoose = require('mongoose')
6 6
7const middlewares = require('../../../middlewares') 7const middlewares = require('../../../middlewares')
8const secureMiddleware = middlewares.secure 8const secureMiddleware = middlewares.secure
9const reqValidator = middlewares.reqValidators.remote 9const validators = middlewares.validators.remote
10const logger = require('../../../helpers/logger') 10const logger = require('../../../helpers/logger')
11 11
12const router = express.Router() 12const router = express.Router()
13const Video = mongoose.model('Video') 13const Video = mongoose.model('Video')
14 14
15router.post('/videos', 15router.post('/videos',
16 reqValidator.signature, 16 validators.signature,
17 reqValidator.dataToDecrypt, 17 validators.dataToDecrypt,
18 secureMiddleware.decryptBody, 18 secureMiddleware.decryptBody,
19 reqValidator.remoteVideos, 19 validators.remoteVideos,
20 remoteVideos 20 remoteVideos
21) 21)
22 22
diff --git a/server/controllers/api/v1/users.js b/server/controllers/api/v1/users.js
index caa979567..dde459a73 100644
--- a/server/controllers/api/v1/users.js
+++ b/server/controllers/api/v1/users.js
@@ -3,6 +3,7 @@
3const config = require('config') 3const config = require('config')
4const mongoose = require('mongoose') 4const mongoose = require('mongoose')
5const express = require('express') 5const express = require('express')
6
6const oAuth = require('../../../middlewares').oauth 7const oAuth = require('../../../middlewares').oauth
7 8
8const Client = mongoose.model('OAuthClient') 9const Client = mongoose.model('OAuthClient')
diff --git a/server/controllers/api/v1/videos.js b/server/controllers/api/v1/videos.js
index ab115bc30..a37e9278e 100644
--- a/server/controllers/api/v1/videos.js
+++ b/server/controllers/api/v1/videos.js
@@ -11,10 +11,10 @@ const friends = require('../../../lib/friends')
11const middlewares = require('../../../middlewares') 11const middlewares = require('../../../middlewares')
12const oAuth = middlewares.oauth 12const oAuth = middlewares.oauth
13const pagination = middlewares.pagination 13const pagination = middlewares.pagination
14const reqValidator = middlewares.reqValidators 14const validators = middlewares.validators
15const reqValidatorPagination = reqValidator.pagination 15const validatorsPagination = validators.pagination
16const reqValidatorSort = reqValidator.sort 16const validatorsSort = validators.sort
17const reqValidatorVideos = reqValidator.videos 17const validatorsVideos = validators.videos
18const search = middlewares.search 18const search = middlewares.search
19const sort = middlewares.sort 19const sort = middlewares.sort
20const utils = require('../../../helpers/utils') 20const utils = require('../../../helpers/utils')
@@ -44,8 +44,8 @@ const storage = multer.diskStorage({
44const reqFiles = multer({ storage: storage }).fields([{ name: 'videofile', maxCount: 1 }]) 44const reqFiles = multer({ storage: storage }).fields([{ name: 'videofile', maxCount: 1 }])
45 45
46router.get('/', 46router.get('/',
47 reqValidatorPagination.pagination, 47 validatorsPagination.pagination,
48 reqValidatorSort.videosSort, 48 validatorsSort.videosSort,
49 sort.setVideosSort, 49 sort.setVideosSort,
50 pagination.setPagination, 50 pagination.setPagination,
51 listVideos 51 listVideos
@@ -53,22 +53,22 @@ router.get('/',
53router.post('/', 53router.post('/',
54 oAuth.authenticate, 54 oAuth.authenticate,
55 reqFiles, 55 reqFiles,
56 reqValidatorVideos.videosAdd, 56 validatorsVideos.videosAdd,
57 addVideo 57 addVideo
58) 58)
59router.get('/:id', 59router.get('/:id',
60 reqValidatorVideos.videosGet, 60 validatorsVideos.videosGet,
61 getVideo 61 getVideo
62) 62)
63router.delete('/:id', 63router.delete('/:id',
64 oAuth.authenticate, 64 oAuth.authenticate,
65 reqValidatorVideos.videosRemove, 65 validatorsVideos.videosRemove,
66 removeVideo 66 removeVideo
67) 67)
68router.get('/search/:value', 68router.get('/search/:value',
69 reqValidatorVideos.videosSearch, 69 validatorsVideos.videosSearch,
70 reqValidatorPagination.pagination, 70 validatorsPagination.pagination,
71 reqValidatorSort.videosSort, 71 validatorsSort.videosSort,
72 sort.setVideosSort, 72 sort.setVideosSort,
73 pagination.setPagination, 73 pagination.setPagination,
74 search.setVideosSearch, 74 search.setVideosSearch,