const logger = require('../../../helpers/logger')
const friends = require('../../../lib/friends')
const middleware = require('../../../middlewares')
-const cacheMiddleware = middleware.cache
const Pods = require('../../../models/pods')
const reqValidator = middleware.reqValidators.pods
const secureMiddleware = middleware.secure
const router = express.Router()
-router.get('/', cacheMiddleware.cache(false), listPods)
-router.post('/', reqValidator.podsAdd, cacheMiddleware.cache(false), addPods)
-router.get('/makefriends', reqValidator.makeFriends, cacheMiddleware.cache(false), makeFriends)
-router.get('/quitfriends', cacheMiddleware.cache(false), quitFriends)
+router.get('/', listPods)
+router.post('/', reqValidator.podsAdd, addPods)
+router.get('/makefriends', reqValidator.makeFriends, makeFriends)
+router.get('/quitfriends', quitFriends)
// Post because this is a secured request
router.post('/remove', secureRequest, secureMiddleware.decryptBody, removePods)
const middleware = require('../../../middlewares')
const secureMiddleware = middleware.secure
-const cacheMiddleware = middleware.cache
const reqValidator = middleware.reqValidators.remote
const logger = require('../../../helpers/logger')
const Videos = require('../../../models/videos')
reqValidator.secureRequest,
secureMiddleware.decryptBody,
reqValidator.remoteVideosAdd,
- cacheMiddleware.cache(false),
addRemoteVideos
)
reqValidator.secureRequest,
secureMiddleware.decryptBody,
reqValidator.remoteVideosRemove,
- cacheMiddleware.cache(false),
removeRemoteVideo
)
const express = require('express')
const oAuth2 = require('../../../middlewares/oauth2')
-const middleware = require('../../../middlewares')
-const cacheMiddleware = middleware.cache
const Users = require('../../../models/users')
const router = express.Router()
-router.get('/client', cacheMiddleware.cache(false), getAngularClient)
-router.post('/token', cacheMiddleware.cache(false), oAuth2.token, success)
+router.get('/client', getAngularClient)
+router.post('/token', oAuth2.token, success)
// ---------------------------------------------------------------------------
const friends = require('../../../lib/friends')
const middleware = require('../../../middlewares')
const oAuth2 = require('../../../middlewares/oauth2')
-const cacheMiddleware = middleware.cache
const reqValidator = middleware.reqValidators.videos
const utils = require('../../../helpers/utils')
const Videos = require('../../../models/videos') // model
const reqFiles = multer({ storage: storage }).fields([{ name: 'videofile', maxCount: 1 }])
const thumbnailsDir = path.join(__dirname, '..', '..', '..', '..', config.get('storage.thumbnails'))
-router.get('/', cacheMiddleware.cache(false), listVideos)
-router.post('/', oAuth2.authenticate, reqFiles, reqValidator.videosAdd, cacheMiddleware.cache(false), addVideo)
-router.get('/:id', reqValidator.videosGet, cacheMiddleware.cache(false), getVideos)
-router.delete('/:id', oAuth2.authenticate, reqValidator.videosRemove, cacheMiddleware.cache(false), removeVideo)
-router.get('/search/:name', reqValidator.videosSearch, cacheMiddleware.cache(false), searchVideos)
+router.get('/', listVideos)
+router.post('/', oAuth2.authenticate, reqFiles, reqValidator.videosAdd, addVideo)
+router.get('/:id', reqValidator.videosGet, getVideos)
+router.delete('/:id', oAuth2.authenticate, reqValidator.videosRemove, removeVideo)
+router.get('/search/:name', reqValidator.videosSearch, searchVideos)
// ---------------------------------------------------------------------------
+++ /dev/null
-'use strict'
-
-const cacheMiddleware = {
- cache: cache
-}
-
-function cache (cache) {
- return function (req, res, next) {
- // If we want explicitly a cache
- // Or if we don't specify if we want a cache or no and we are in production
- if (cache === true || (cache !== false && process.env.NODE_ENV === 'production')) {
- res.setHeader('Cache-Control', 'public')
- } else {
- res.setHeader('Cache-Control', 'no-cache, no-store, max-age=0, must-revalidate')
- }
-
- next()
- }
-}
-
-// ---------------------------------------------------------------------------
-
-module.exports = cacheMiddleware
'use strict'
-const cacheMiddleware = require('./cache')
const reqValidatorsMiddleware = require('./reqValidators')
const secureMiddleware = require('./secure')
const middlewares = {
- cache: cacheMiddleware,
reqValidators: reqValidatorsMiddleware,
secure: secureMiddleware
}