diff options
Diffstat (limited to 'server/middlewares/secure.js')
-rw-r--r-- | server/middlewares/secure.js | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/server/middlewares/secure.js b/server/middlewares/secure.js index ad7b0fbf7..fbaf4d0f2 100644 --- a/server/middlewares/secure.js +++ b/server/middlewares/secure.js | |||
@@ -1,8 +1,10 @@ | |||
1 | 'use strict' | 1 | 'use strict' |
2 | 2 | ||
3 | const logger = require('../helpers/logger') | 3 | const logger = require('../helpers/logger') |
4 | const mongoose = require('mongoose') | ||
4 | const peertubeCrypto = require('../helpers/peertubeCrypto') | 5 | const peertubeCrypto = require('../helpers/peertubeCrypto') |
5 | const Pods = require('../models/pods') | 6 | |
7 | const Pod = mongoose.model('Pod') | ||
6 | 8 | ||
7 | const secureMiddleware = { | 9 | const secureMiddleware = { |
8 | decryptBody: decryptBody | 10 | decryptBody: decryptBody |
@@ -10,7 +12,7 @@ const secureMiddleware = { | |||
10 | 12 | ||
11 | function decryptBody (req, res, next) { | 13 | function decryptBody (req, res, next) { |
12 | const url = req.body.signature.url | 14 | const url = req.body.signature.url |
13 | Pods.findByUrl(url, function (err, pod) { | 15 | Pod.loadByUrl(url, function (err, pod) { |
14 | if (err) { | 16 | if (err) { |
15 | logger.error('Cannot get signed url in decryptBody.', { error: err }) | 17 | logger.error('Cannot get signed url in decryptBody.', { error: err }) |
16 | return res.sendStatus(500) | 18 | return res.sendStatus(500) |