aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/secure.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-06-30 22:39:08 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-06-30 22:39:08 +0200
commita3ee6fa22dee4b68fcde9cd23708b471db446e11 (patch)
treeb05543f6d858c52dd4757123bc605277ede96983 /server/middlewares/secure.js
parentd14b3e37a2c0d647b59259bf2ca059b5817f144c (diff)
downloadPeerTube-a3ee6fa22dee4b68fcde9cd23708b471db446e11.tar.gz
PeerTube-a3ee6fa22dee4b68fcde9cd23708b471db446e11.tar.zst
PeerTube-a3ee6fa22dee4b68fcde9cd23708b471db446e11.zip
Pod model refractoring -> use mongoose api
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)