aboutsummaryrefslogtreecommitdiffhomepage
path: root/controllers/api/v1
diff options
context:
space:
mode:
Diffstat (limited to 'controllers/api/v1')
-rw-r--r--controllers/api/v1/pods.js13
-rw-r--r--controllers/api/v1/remoteVideos.js11
-rw-r--r--controllers/api/v1/videos.js12
3 files changed, 19 insertions, 17 deletions
diff --git a/controllers/api/v1/pods.js b/controllers/api/v1/pods.js
index 82d8d7f08..3e457ec57 100644
--- a/controllers/api/v1/pods.js
+++ b/controllers/api/v1/pods.js
@@ -7,21 +7,22 @@
7 var logger = require('../../../helpers/logger') 7 var logger = require('../../../helpers/logger')
8 var friends = require('../../../lib/friends') 8 var friends = require('../../../lib/friends')
9 var middleware = require('../../../middlewares') 9 var middleware = require('../../../middlewares')
10 var miscMiddleware = middleware.misc 10 var cacheMiddleware = middleware.cache
11 var Pods = require('../../../models/pods') 11 var Pods = require('../../../models/pods')
12 var reqValidator = middleware.reqValidators.pods 12 var reqValidator = middleware.reqValidators.pods
13 var secureMiddleware = middleware.secure
13 var secureRequest = middleware.reqValidators.remote.secureRequest 14 var secureRequest = middleware.reqValidators.remote.secureRequest
14 var utils = require('../../../helpers/utils') 15 var utils = require('../../../helpers/utils')
15 var Videos = require('../../../models/videos') 16 var Videos = require('../../../models/videos')
16 17
17 var router = express.Router() 18 var router = express.Router()
18 19
19 router.get('/', miscMiddleware.cache(false), listPods) 20 router.get('/', cacheMiddleware.cache(false), listPods)
20 router.post('/', reqValidator.podsAdd, miscMiddleware.cache(false), addPods) 21 router.post('/', reqValidator.podsAdd, cacheMiddleware.cache(false), addPods)
21 router.get('/makefriends', reqValidator.makeFriends, miscMiddleware.cache(false), makeFriends) 22 router.get('/makefriends', reqValidator.makeFriends, cacheMiddleware.cache(false), makeFriends)
22 router.get('/quitfriends', miscMiddleware.cache(false), quitFriends) 23 router.get('/quitfriends', cacheMiddleware.cache(false), quitFriends)
23 // Post because this is a secured request 24 // Post because this is a secured request
24 router.post('/remove', secureRequest, miscMiddleware.decryptBody, removePods) 25 router.post('/remove', secureRequest, secureMiddleware.decryptBody, removePods)
25 26
26 // --------------------------------------------------------------------------- 27 // ---------------------------------------------------------------------------
27 28
diff --git a/controllers/api/v1/remoteVideos.js b/controllers/api/v1/remoteVideos.js
index d72db9836..58bb5f3cb 100644
--- a/controllers/api/v1/remoteVideos.js
+++ b/controllers/api/v1/remoteVideos.js
@@ -5,7 +5,8 @@
5 var pluck = require('lodash-node/compat/collection/pluck') 5 var pluck = require('lodash-node/compat/collection/pluck')
6 6
7 var middleware = require('../../../middlewares') 7 var middleware = require('../../../middlewares')
8 var miscMiddleware = middleware.misc 8 var secureMiddleware = middleware.secure
9 var cacheMiddleware = middleware.cache
9 var reqValidator = middleware.reqValidators.remote 10 var reqValidator = middleware.reqValidators.remote
10 var videos = require('../../../models/videos') 11 var videos = require('../../../models/videos')
11 12
@@ -13,17 +14,17 @@
13 14
14 router.post('/add', 15 router.post('/add',
15 reqValidator.secureRequest, 16 reqValidator.secureRequest,
16 miscMiddleware.decryptBody, 17 secureMiddleware.decryptBody,
17 reqValidator.remoteVideosAdd, 18 reqValidator.remoteVideosAdd,
18 miscMiddleware.cache(false), 19 cacheMiddleware.cache(false),
19 addRemoteVideos 20 addRemoteVideos
20 ) 21 )
21 22
22 router.post('/remove', 23 router.post('/remove',
23 reqValidator.secureRequest, 24 reqValidator.secureRequest,
24 miscMiddleware.decryptBody, 25 secureMiddleware.decryptBody,
25 reqValidator.remoteVideosRemove, 26 reqValidator.remoteVideosRemove,
26 miscMiddleware.cache(false), 27 cacheMiddleware.cache(false),
27 removeRemoteVideo 28 removeRemoteVideo
28 ) 29 )
29 30
diff --git a/controllers/api/v1/videos.js b/controllers/api/v1/videos.js
index d2e7e8825..7792059ca 100644
--- a/controllers/api/v1/videos.js
+++ b/controllers/api/v1/videos.js
@@ -9,7 +9,7 @@
9 var logger = require('../../../helpers/logger') 9 var logger = require('../../../helpers/logger')
10 var friends = require('../../../lib/friends') 10 var friends = require('../../../lib/friends')
11 var middleware = require('../../../middlewares') 11 var middleware = require('../../../middlewares')
12 var miscMiddleware = middleware.misc 12 var cacheMiddleware = middleware.cache
13 var reqValidator = middleware.reqValidators.videos 13 var reqValidator = middleware.reqValidators.videos
14 var Videos = require('../../../models/videos') // model 14 var Videos = require('../../../models/videos') // model
15 var videos = require('../../../lib/videos') 15 var videos = require('../../../lib/videos')
@@ -38,11 +38,11 @@
38 38
39 var reqFiles = multer({ storage: storage }).fields([{ name: 'input_video', maxCount: 1 }]) 39 var reqFiles = multer({ storage: storage }).fields([{ name: 'input_video', maxCount: 1 }])
40 40
41 router.get('/', miscMiddleware.cache(false), listVideos) 41 router.get('/', cacheMiddleware.cache(false), listVideos)
42 router.post('/', reqFiles, reqValidator.videosAdd, miscMiddleware.cache(false), addVideo) 42 router.post('/', reqFiles, reqValidator.videosAdd, cacheMiddleware.cache(false), addVideo)
43 router.get('/:id', reqValidator.videosGet, miscMiddleware.cache(false), getVideos) 43 router.get('/:id', reqValidator.videosGet, cacheMiddleware.cache(false), getVideos)
44 router.delete('/:id', reqValidator.videosRemove, miscMiddleware.cache(false), removeVideo) 44 router.delete('/:id', reqValidator.videosRemove, cacheMiddleware.cache(false), removeVideo)
45 router.get('/search/:name', reqValidator.videosSearch, miscMiddleware.cache(false), searchVideos) 45 router.get('/search/:name', reqValidator.videosSearch, cacheMiddleware.cache(false), searchVideos)
46 46
47 // --------------------------------------------------------------------------- 47 // ---------------------------------------------------------------------------
48 48