aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/secure.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-12-11 21:50:51 +0100
committerChocobozzz <florian.bigard@gmail.com>2016-12-19 21:22:28 +0100
commitfeb4bdfd9b46e87aadfa7c0d5338cde887d1f58c (patch)
tree2abc9fbc9569760e218fd52835850b757344b420 /server/middlewares/secure.js
parent108626609eda75e4ecc0a83a650a4d53c46220e0 (diff)
downloadPeerTube-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.js6
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
3const db = require('../initializers/database')
3const logger = require('../helpers/logger') 4const logger = require('../helpers/logger')
4const mongoose = require('mongoose')
5const peertubeCrypto = require('../helpers/peertube-crypto') 5const peertubeCrypto = require('../helpers/peertube-crypto')
6 6
7const Pod = mongoose.model('Pod')
8
9const secureMiddleware = { 7const secureMiddleware = {
10 checkSignature 8 checkSignature
11} 9}
12 10
13function checkSignature (req, res, next) { 11function 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)