Now also the ip address is passed to the sendRequest function in requestRepository so that the requesters ip address can be logged in the database.

This commit is contained in:
2017-09-26 20:43:56 +02:00
parent d47f2bf757
commit daa9a7749e

View File

@@ -12,8 +12,9 @@ function submitRequestController(req, res) {
// This is the id that is the param of the url
const id = req.params.mediaId;
const type = req.query.type;
var ip = req.headers['x-forwarded-for'] || req.connection.remoteAddress;
requestRepository.sendRequest(id, type)
requestRepository.sendRequest(id, type, ip)
.then(() => {
res.send({ success: true, message: 'Media item sucessfully requested!' });
})