diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-12-11 21:50:51 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-12-19 21:22:28 +0100 |
commit | feb4bdfd9b46e87aadfa7c0d5338cde887d1f58c (patch) | |
tree | 2abc9fbc9569760e218fd52835850b757344b420 /server/middlewares/secure.js | |
parent | 108626609eda75e4ecc0a83a650a4d53c46220e0 (diff) | |
download | PeerTube-feb4bdfd9b46e87aadfa7c0d5338cde887d1f58c.tar.gz PeerTube-feb4bdfd9b46e87aadfa7c0d5338cde887d1f58c.tar.zst PeerTube-feb4bdfd9b46e87aadfa7c0d5338cde887d1f58c.zip |
First version with PostgreSQL
Diffstat (limited to 'server/middlewares/secure.js')
-rw-r--r-- | server/middlewares/secure.js | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/server/middlewares/secure.js b/server/middlewares/secure.js index ee836beed..b7b4cdfb4 100644 --- a/server/middlewares/secure.js +++ b/server/middlewares/secure.js | |||
@@ -1,18 +1,16 @@ | |||
1 | 'use strict' | 1 | 'use strict' |
2 | 2 | ||
3 | const db = require('../initializers/database') | ||
3 | const logger = require('../helpers/logger') | 4 | const logger = require('../helpers/logger') |
4 | const mongoose = require('mongoose') | ||
5 | const peertubeCrypto = require('../helpers/peertube-crypto') | 5 | const peertubeCrypto = require('../helpers/peertube-crypto') |
6 | 6 | ||
7 | const Pod = mongoose.model('Pod') | ||
8 | |||
9 | const secureMiddleware = { | 7 | const secureMiddleware = { |
10 | checkSignature | 8 | checkSignature |
11 | } | 9 | } |
12 | 10 | ||
13 | function checkSignature (req, res, next) { | 11 | function checkSignature (req, res, next) { |
14 | const host = req.body.signature.host | 12 | const host = req.body.signature.host |
15 | Pod.loadByHost(host, function (err, pod) { | 13 | db.Pod.loadByHost(host, function (err, pod) { |
16 | if (err) { | 14 | if (err) { |
17 | logger.error('Cannot get signed host in body.', { error: err }) | 15 | logger.error('Cannot get signed host in body.', { error: err }) |
18 | return res.sendStatus(500) | 16 | return res.sendStatus(500) |