diff options
Diffstat (limited to 'server/middlewares')
-rw-r--r-- | server/middlewares/cache.js | 2 | ||||
-rw-r--r-- | server/middlewares/index.js | 8 | ||||
-rw-r--r-- | server/middlewares/reqValidators/index.js | 8 | ||||
-rw-r--r-- | server/middlewares/reqValidators/pods.js | 8 | ||||
-rw-r--r-- | server/middlewares/reqValidators/remote.js | 6 | ||||
-rw-r--r-- | server/middlewares/reqValidators/utils.js | 8 | ||||
-rw-r--r-- | server/middlewares/reqValidators/videos.js | 10 | ||||
-rw-r--r-- | server/middlewares/secure.js | 12 |
8 files changed, 31 insertions, 31 deletions
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 @@ | |||
1 | 'use strict' | 1 | 'use strict' |
2 | 2 | ||
3 | var cacheMiddleware = { | 3 | const cacheMiddleware = { |
4 | cache: cache | 4 | cache: cache |
5 | } | 5 | } |
6 | 6 | ||
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 @@ | |||
1 | 'use strict' | 1 | 'use strict' |
2 | 2 | ||
3 | var cacheMiddleware = require('./cache') | 3 | const cacheMiddleware = require('./cache') |
4 | var reqValidatorsMiddleware = require('./reqValidators') | 4 | const reqValidatorsMiddleware = require('./reqValidators') |
5 | var secureMiddleware = require('./secure') | 5 | const secureMiddleware = require('./secure') |
6 | 6 | ||
7 | var middlewares = { | 7 | const middlewares = { |
8 | cache: cacheMiddleware, | 8 | cache: cacheMiddleware, |
9 | reqValidators: reqValidatorsMiddleware, | 9 | reqValidators: reqValidatorsMiddleware, |
10 | secure: secureMiddleware | 10 | 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 @@ | |||
1 | 'use strict' | 1 | 'use strict' |
2 | 2 | ||
3 | var podsReqValidators = require('./pods') | 3 | const podsReqValidators = require('./pods') |
4 | var remoteReqValidators = require('./remote') | 4 | const remoteReqValidators = require('./remote') |
5 | var videosReqValidators = require('./videos') | 5 | const videosReqValidators = require('./videos') |
6 | 6 | ||
7 | var reqValidators = { | 7 | const reqValidators = { |
8 | pods: podsReqValidators, | 8 | pods: podsReqValidators, |
9 | remote: remoteReqValidators, | 9 | remote: remoteReqValidators, |
10 | videos: videosReqValidators | 10 | 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 @@ | |||
1 | 'use strict' | 1 | 'use strict' |
2 | 2 | ||
3 | var checkErrors = require('./utils').checkErrors | 3 | const checkErrors = require('./utils').checkErrors |
4 | var friends = require('../../lib/friends') | 4 | const friends = require('../../lib/friends') |
5 | var logger = require('../../helpers/logger') | 5 | const logger = require('../../helpers/logger') |
6 | 6 | ||
7 | var reqValidatorsPod = { | 7 | const reqValidatorsPod = { |
8 | makeFriends: makeFriends, | 8 | makeFriends: makeFriends, |
9 | podsAdd: podsAdd | 9 | podsAdd: podsAdd |
10 | } | 10 | } |
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 @@ | |||
1 | 'use strict' | 1 | 'use strict' |
2 | 2 | ||
3 | var checkErrors = require('./utils').checkErrors | 3 | const checkErrors = require('./utils').checkErrors |
4 | var logger = require('../../helpers/logger') | 4 | const logger = require('../../helpers/logger') |
5 | 5 | ||
6 | var reqValidatorsRemote = { | 6 | const reqValidatorsRemote = { |
7 | remoteVideosAdd: remoteVideosAdd, | 7 | remoteVideosAdd: remoteVideosAdd, |
8 | remoteVideosRemove: remoteVideosRemove, | 8 | remoteVideosRemove: remoteVideosRemove, |
9 | secureRequest: secureRequest | 9 | 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 @@ | |||
1 | 'use strict' | 1 | 'use strict' |
2 | 2 | ||
3 | var util = require('util') | 3 | const util = require('util') |
4 | 4 | ||
5 | var logger = require('../../helpers/logger') | 5 | const logger = require('../../helpers/logger') |
6 | 6 | ||
7 | var reqValidatorsUtils = { | 7 | const reqValidatorsUtils = { |
8 | checkErrors: checkErrors | 8 | checkErrors: checkErrors |
9 | } | 9 | } |
10 | 10 | ||
11 | function checkErrors (req, res, next, status_code) { | 11 | function checkErrors (req, res, next, status_code) { |
12 | if (status_code === undefined) status_code = 400 | 12 | if (status_code === undefined) status_code = 400 |
13 | var errors = req.validationErrors() | 13 | const errors = req.validationErrors() |
14 | 14 | ||
15 | if (errors) { | 15 | if (errors) { |
16 | logger.warn('Incorrect request parameters', { path: req.originalUrl, err: errors }) | 16 | 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 @@ | |||
1 | 'use strict' | 1 | 'use strict' |
2 | 2 | ||
3 | var checkErrors = require('./utils').checkErrors | 3 | const checkErrors = require('./utils').checkErrors |
4 | var logger = require('../../helpers/logger') | 4 | const logger = require('../../helpers/logger') |
5 | var videos = require('../../lib/videos') | 5 | const videos = require('../../lib/videos') |
6 | var Videos = require('../../models/videos') | 6 | const Videos = require('../../models/videos') |
7 | 7 | ||
8 | var reqValidatorsVideos = { | 8 | const reqValidatorsVideos = { |
9 | videosAdd: videosAdd, | 9 | videosAdd: videosAdd, |
10 | videosGet: videosGet, | 10 | videosGet: videosGet, |
11 | videosRemove: videosRemove, | 11 | 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 @@ | |||
1 | 'use strict' | 1 | 'use strict' |
2 | 2 | ||
3 | var logger = require('../helpers/logger') | 3 | const logger = require('../helpers/logger') |
4 | var peertubeCrypto = require('../helpers/peertubeCrypto') | 4 | const peertubeCrypto = require('../helpers/peertubeCrypto') |
5 | var Pods = require('../models/pods') | 5 | const Pods = require('../models/pods') |
6 | 6 | ||
7 | var secureMiddleware = { | 7 | const secureMiddleware = { |
8 | decryptBody: decryptBody | 8 | decryptBody: decryptBody |
9 | } | 9 | } |
10 | 10 | ||
11 | function decryptBody (req, res, next) { | 11 | function decryptBody (req, res, next) { |
12 | var url = req.body.signature.url | 12 | const url = req.body.signature.url |
13 | Pods.findByUrl(url, function (err, pod) { | 13 | Pods.findByUrl(url, function (err, pod) { |
14 | if (err) { | 14 | if (err) { |
15 | logger.error('Cannot get signed url in decryptBody.', { error: err }) | 15 | logger.error('Cannot get signed url in decryptBody.', { error: err }) |
@@ -23,7 +23,7 @@ function decryptBody (req, res, next) { | |||
23 | 23 | ||
24 | logger.debug('Decrypting body from %s.', url) | 24 | logger.debug('Decrypting body from %s.', url) |
25 | 25 | ||
26 | var signature_ok = peertubeCrypto.checkSignature(pod.publicKey, url, req.body.signature.signature) | 26 | const signature_ok = peertubeCrypto.checkSignature(pod.publicKey, url, req.body.signature.signature) |
27 | 27 | ||
28 | if (signature_ok === true) { | 28 | if (signature_ok === true) { |
29 | peertubeCrypto.decrypt(req.body.key, req.body.data, function (err, decrypted) { | 29 | peertubeCrypto.decrypt(req.body.key, req.body.data, function (err, decrypted) { |