From f0f5567b6918fc60c8cab15e13aec03a89a91dfb Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 16 Mar 2016 22:29:27 +0100 Subject: Use const/let now we use node 4.2 --- server/middlewares/cache.js | 2 +- server/middlewares/index.js | 8 ++++---- server/middlewares/reqValidators/index.js | 8 ++++---- server/middlewares/reqValidators/pods.js | 8 ++++---- server/middlewares/reqValidators/remote.js | 6 +++--- server/middlewares/reqValidators/utils.js | 8 ++++---- server/middlewares/reqValidators/videos.js | 10 +++++----- server/middlewares/secure.js | 12 ++++++------ 8 files changed, 31 insertions(+), 31 deletions(-) (limited to 'server/middlewares') diff --git a/server/middlewares/cache.js b/server/middlewares/cache.js index 0d3da0075..1b621f6dc 100644 --- a/server/middlewares/cache.js +++ b/server/middlewares/cache.js @@ -1,6 +1,6 @@ 'use strict' -var cacheMiddleware = { +const cacheMiddleware = { cache: cache } diff --git a/server/middlewares/index.js b/server/middlewares/index.js index c85899b0c..d85f6261c 100644 --- a/server/middlewares/index.js +++ b/server/middlewares/index.js @@ -1,10 +1,10 @@ 'use strict' -var cacheMiddleware = require('./cache') -var reqValidatorsMiddleware = require('./reqValidators') -var secureMiddleware = require('./secure') +const cacheMiddleware = require('./cache') +const reqValidatorsMiddleware = require('./reqValidators') +const secureMiddleware = require('./secure') -var middlewares = { +const middlewares = { cache: cacheMiddleware, reqValidators: reqValidatorsMiddleware, secure: secureMiddleware diff --git a/server/middlewares/reqValidators/index.js b/server/middlewares/reqValidators/index.js index 345dbd0e2..c6c5e1309 100644 --- a/server/middlewares/reqValidators/index.js +++ b/server/middlewares/reqValidators/index.js @@ -1,10 +1,10 @@ 'use strict' -var podsReqValidators = require('./pods') -var remoteReqValidators = require('./remote') -var videosReqValidators = require('./videos') +const podsReqValidators = require('./pods') +const remoteReqValidators = require('./remote') +const videosReqValidators = require('./videos') -var reqValidators = { +const reqValidators = { pods: podsReqValidators, remote: remoteReqValidators, videos: videosReqValidators diff --git a/server/middlewares/reqValidators/pods.js b/server/middlewares/reqValidators/pods.js index ef09d51cf..45e34c1ab 100644 --- a/server/middlewares/reqValidators/pods.js +++ b/server/middlewares/reqValidators/pods.js @@ -1,10 +1,10 @@ 'use strict' -var checkErrors = require('./utils').checkErrors -var friends = require('../../lib/friends') -var logger = require('../../helpers/logger') +const checkErrors = require('./utils').checkErrors +const friends = require('../../lib/friends') +const logger = require('../../helpers/logger') -var reqValidatorsPod = { +const reqValidatorsPod = { makeFriends: makeFriends, podsAdd: podsAdd } diff --git a/server/middlewares/reqValidators/remote.js b/server/middlewares/reqValidators/remote.js index 88de16b49..3bc0e0f40 100644 --- a/server/middlewares/reqValidators/remote.js +++ b/server/middlewares/reqValidators/remote.js @@ -1,9 +1,9 @@ 'use strict' -var checkErrors = require('./utils').checkErrors -var logger = require('../../helpers/logger') +const checkErrors = require('./utils').checkErrors +const logger = require('../../helpers/logger') -var reqValidatorsRemote = { +const reqValidatorsRemote = { remoteVideosAdd: remoteVideosAdd, remoteVideosRemove: remoteVideosRemove, secureRequest: secureRequest diff --git a/server/middlewares/reqValidators/utils.js b/server/middlewares/reqValidators/utils.js index 46c982571..05675c445 100644 --- a/server/middlewares/reqValidators/utils.js +++ b/server/middlewares/reqValidators/utils.js @@ -1,16 +1,16 @@ 'use strict' -var util = require('util') +const util = require('util') -var logger = require('../../helpers/logger') +const logger = require('../../helpers/logger') -var reqValidatorsUtils = { +const reqValidatorsUtils = { checkErrors: checkErrors } function checkErrors (req, res, next, status_code) { if (status_code === undefined) status_code = 400 - var errors = req.validationErrors() + const errors = req.validationErrors() if (errors) { logger.warn('Incorrect request parameters', { path: req.originalUrl, err: errors }) diff --git a/server/middlewares/reqValidators/videos.js b/server/middlewares/reqValidators/videos.js index b0a6d0360..4057e72cd 100644 --- a/server/middlewares/reqValidators/videos.js +++ b/server/middlewares/reqValidators/videos.js @@ -1,11 +1,11 @@ 'use strict' -var checkErrors = require('./utils').checkErrors -var logger = require('../../helpers/logger') -var videos = require('../../lib/videos') -var Videos = require('../../models/videos') +const checkErrors = require('./utils').checkErrors +const logger = require('../../helpers/logger') +const videos = require('../../lib/videos') +const Videos = require('../../models/videos') -var reqValidatorsVideos = { +const reqValidatorsVideos = { videosAdd: videosAdd, videosGet: videosGet, videosRemove: videosRemove, diff --git a/server/middlewares/secure.js b/server/middlewares/secure.js index bfd28316a..9ecbf5df1 100644 --- a/server/middlewares/secure.js +++ b/server/middlewares/secure.js @@ -1,15 +1,15 @@ 'use strict' -var logger = require('../helpers/logger') -var peertubeCrypto = require('../helpers/peertubeCrypto') -var Pods = require('../models/pods') +const logger = require('../helpers/logger') +const peertubeCrypto = require('../helpers/peertubeCrypto') +const Pods = require('../models/pods') -var secureMiddleware = { +const secureMiddleware = { decryptBody: decryptBody } function decryptBody (req, res, next) { - var url = req.body.signature.url + const url = req.body.signature.url Pods.findByUrl(url, function (err, pod) { if (err) { logger.error('Cannot get signed url in decryptBody.', { error: err }) @@ -23,7 +23,7 @@ function decryptBody (req, res, next) { logger.debug('Decrypting body from %s.', url) - var signature_ok = peertubeCrypto.checkSignature(pod.publicKey, url, req.body.signature.signature) + const signature_ok = peertubeCrypto.checkSignature(pod.publicKey, url, req.body.signature.signature) if (signature_ok === true) { peertubeCrypto.decrypt(req.body.key, req.body.data, function (err, decrypted) { -- cgit v1.2.3