diff options
Diffstat (limited to 'server/controllers/api')
-rw-r--r-- | server/controllers/api/v1/pods.js | 9 | ||||
-rw-r--r-- | server/controllers/api/v1/remoteVideos.js | 3 | ||||
-rw-r--r-- | server/controllers/api/v1/users.js | 6 | ||||
-rw-r--r-- | server/controllers/api/v1/videos.js | 11 |
4 files changed, 11 insertions, 18 deletions
diff --git a/server/controllers/api/v1/pods.js b/server/controllers/api/v1/pods.js index b16fea4f6..fd13034a2 100644 --- a/server/controllers/api/v1/pods.js +++ b/server/controllers/api/v1/pods.js | |||
@@ -5,7 +5,6 @@ const express = require('express') | |||
5 | const logger = require('../../../helpers/logger') | 5 | const logger = require('../../../helpers/logger') |
6 | const friends = require('../../../lib/friends') | 6 | const friends = require('../../../lib/friends') |
7 | const middleware = require('../../../middlewares') | 7 | const middleware = require('../../../middlewares') |
8 | const cacheMiddleware = middleware.cache | ||
9 | const Pods = require('../../../models/pods') | 8 | const Pods = require('../../../models/pods') |
10 | const reqValidator = middleware.reqValidators.pods | 9 | const reqValidator = middleware.reqValidators.pods |
11 | const secureMiddleware = middleware.secure | 10 | const secureMiddleware = middleware.secure |
@@ -15,10 +14,10 @@ const Videos = require('../../../models/videos') | |||
15 | 14 | ||
16 | const router = express.Router() | 15 | const router = express.Router() |
17 | 16 | ||
18 | router.get('/', cacheMiddleware.cache(false), listPods) | 17 | router.get('/', listPods) |
19 | router.post('/', reqValidator.podsAdd, cacheMiddleware.cache(false), addPods) | 18 | router.post('/', reqValidator.podsAdd, addPods) |
20 | router.get('/makefriends', reqValidator.makeFriends, cacheMiddleware.cache(false), makeFriends) | 19 | router.get('/makefriends', reqValidator.makeFriends, makeFriends) |
21 | router.get('/quitfriends', cacheMiddleware.cache(false), quitFriends) | 20 | router.get('/quitfriends', quitFriends) |
22 | // Post because this is a secured request | 21 | // Post because this is a secured request |
23 | router.post('/remove', secureRequest, secureMiddleware.decryptBody, removePods) | 22 | router.post('/remove', secureRequest, secureMiddleware.decryptBody, removePods) |
24 | 23 | ||
diff --git a/server/controllers/api/v1/remoteVideos.js b/server/controllers/api/v1/remoteVideos.js index 7da9f0105..cc4bc41e2 100644 --- a/server/controllers/api/v1/remoteVideos.js +++ b/server/controllers/api/v1/remoteVideos.js | |||
@@ -5,7 +5,6 @@ const map = require('lodash/map') | |||
5 | 5 | ||
6 | const middleware = require('../../../middlewares') | 6 | const middleware = require('../../../middlewares') |
7 | const secureMiddleware = middleware.secure | 7 | const secureMiddleware = middleware.secure |
8 | const cacheMiddleware = middleware.cache | ||
9 | const reqValidator = middleware.reqValidators.remote | 8 | const reqValidator = middleware.reqValidators.remote |
10 | const logger = require('../../../helpers/logger') | 9 | const logger = require('../../../helpers/logger') |
11 | const Videos = require('../../../models/videos') | 10 | const Videos = require('../../../models/videos') |
@@ -17,7 +16,6 @@ router.post('/add', | |||
17 | reqValidator.secureRequest, | 16 | reqValidator.secureRequest, |
18 | secureMiddleware.decryptBody, | 17 | secureMiddleware.decryptBody, |
19 | reqValidator.remoteVideosAdd, | 18 | reqValidator.remoteVideosAdd, |
20 | cacheMiddleware.cache(false), | ||
21 | addRemoteVideos | 19 | addRemoteVideos |
22 | ) | 20 | ) |
23 | 21 | ||
@@ -25,7 +23,6 @@ router.post('/remove', | |||
25 | reqValidator.secureRequest, | 23 | reqValidator.secureRequest, |
26 | secureMiddleware.decryptBody, | 24 | secureMiddleware.decryptBody, |
27 | reqValidator.remoteVideosRemove, | 25 | reqValidator.remoteVideosRemove, |
28 | cacheMiddleware.cache(false), | ||
29 | removeRemoteVideo | 26 | removeRemoteVideo |
30 | ) | 27 | ) |
31 | 28 | ||
diff --git a/server/controllers/api/v1/users.js b/server/controllers/api/v1/users.js index 0584d5cdf..54ff0d743 100644 --- a/server/controllers/api/v1/users.js +++ b/server/controllers/api/v1/users.js | |||
@@ -4,14 +4,12 @@ const config = require('config') | |||
4 | const express = require('express') | 4 | const express = require('express') |
5 | const oAuth2 = require('../../../middlewares/oauth2') | 5 | const oAuth2 = require('../../../middlewares/oauth2') |
6 | 6 | ||
7 | const middleware = require('../../../middlewares') | ||
8 | const cacheMiddleware = middleware.cache | ||
9 | const Users = require('../../../models/users') | 7 | const Users = require('../../../models/users') |
10 | 8 | ||
11 | const router = express.Router() | 9 | const router = express.Router() |
12 | 10 | ||
13 | router.get('/client', cacheMiddleware.cache(false), getAngularClient) | 11 | router.get('/client', getAngularClient) |
14 | router.post('/token', cacheMiddleware.cache(false), oAuth2.token, success) | 12 | router.post('/token', oAuth2.token, success) |
15 | 13 | ||
16 | // --------------------------------------------------------------------------- | 14 | // --------------------------------------------------------------------------- |
17 | 15 | ||
diff --git a/server/controllers/api/v1/videos.js b/server/controllers/api/v1/videos.js index c86a96a25..9891bf4c6 100644 --- a/server/controllers/api/v1/videos.js +++ b/server/controllers/api/v1/videos.js | |||
@@ -11,7 +11,6 @@ const logger = require('../../../helpers/logger') | |||
11 | const friends = require('../../../lib/friends') | 11 | const friends = require('../../../lib/friends') |
12 | const middleware = require('../../../middlewares') | 12 | const middleware = require('../../../middlewares') |
13 | const oAuth2 = require('../../../middlewares/oauth2') | 13 | const oAuth2 = require('../../../middlewares/oauth2') |
14 | const cacheMiddleware = middleware.cache | ||
15 | const reqValidator = middleware.reqValidators.videos | 14 | const reqValidator = middleware.reqValidators.videos |
16 | const utils = require('../../../helpers/utils') | 15 | const utils = require('../../../helpers/utils') |
17 | const Videos = require('../../../models/videos') // model | 16 | const Videos = require('../../../models/videos') // model |
@@ -42,11 +41,11 @@ const storage = multer.diskStorage({ | |||
42 | const reqFiles = multer({ storage: storage }).fields([{ name: 'videofile', maxCount: 1 }]) | 41 | const reqFiles = multer({ storage: storage }).fields([{ name: 'videofile', maxCount: 1 }]) |
43 | const thumbnailsDir = path.join(__dirname, '..', '..', '..', '..', config.get('storage.thumbnails')) | 42 | const thumbnailsDir = path.join(__dirname, '..', '..', '..', '..', config.get('storage.thumbnails')) |
44 | 43 | ||
45 | router.get('/', cacheMiddleware.cache(false), listVideos) | 44 | router.get('/', listVideos) |
46 | router.post('/', oAuth2.authenticate, reqFiles, reqValidator.videosAdd, cacheMiddleware.cache(false), addVideo) | 45 | router.post('/', oAuth2.authenticate, reqFiles, reqValidator.videosAdd, addVideo) |
47 | router.get('/:id', reqValidator.videosGet, cacheMiddleware.cache(false), getVideos) | 46 | router.get('/:id', reqValidator.videosGet, getVideos) |
48 | router.delete('/:id', oAuth2.authenticate, reqValidator.videosRemove, cacheMiddleware.cache(false), removeVideo) | 47 | router.delete('/:id', oAuth2.authenticate, reqValidator.videosRemove, removeVideo) |
49 | router.get('/search/:name', reqValidator.videosSearch, cacheMiddleware.cache(false), searchVideos) | 48 | router.get('/search/:name', reqValidator.videosSearch, searchVideos) |
50 | 49 | ||
51 | // --------------------------------------------------------------------------- | 50 | // --------------------------------------------------------------------------- |
52 | 51 | ||