aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/secure.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/middlewares/secure.js')
-rw-r--r--server/middlewares/secure.js6
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
3const logger = require('../helpers/logger') 3const logger = require('../helpers/logger')
4const mongoose = require('mongoose')
4const peertubeCrypto = require('../helpers/peertubeCrypto') 5const peertubeCrypto = require('../helpers/peertubeCrypto')
5const Pods = require('../models/pods') 6
7const Pod = mongoose.model('Pod')
6 8
7const secureMiddleware = { 9const secureMiddleware = {
8 decryptBody: decryptBody 10 decryptBody: decryptBody
@@ -10,7 +12,7 @@ const secureMiddleware = {
10 12
11function decryptBody (req, res, next) { 13function 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)