diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-06-30 22:39:08 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-06-30 22:39:08 +0200 |
commit | a3ee6fa22dee4b68fcde9cd23708b471db446e11 (patch) | |
tree | b05543f6d858c52dd4757123bc605277ede96983 /server/middlewares | |
parent | d14b3e37a2c0d647b59259bf2ca059b5817f144c (diff) | |
download | PeerTube-a3ee6fa22dee4b68fcde9cd23708b471db446e11.tar.gz PeerTube-a3ee6fa22dee4b68fcde9cd23708b471db446e11.tar.zst PeerTube-a3ee6fa22dee4b68fcde9cd23708b471db446e11.zip |
Pod model refractoring -> use mongoose api
Diffstat (limited to 'server/middlewares')
-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) |