From daa9a7749eb805fe11270d912853e3058f5972e8 Mon Sep 17 00:00:00 2001 From: KevinMidboe Date: Tue, 26 Sep 2017 20:43:56 +0200 Subject: [PATCH] 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. --- seasoned_api/src/webserver/controllers/plex/submitRequest.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/seasoned_api/src/webserver/controllers/plex/submitRequest.js b/seasoned_api/src/webserver/controllers/plex/submitRequest.js index fd6345f..f8ff4c2 100644 --- a/seasoned_api/src/webserver/controllers/plex/submitRequest.js +++ b/seasoned_api/src/webserver/controllers/plex/submitRequest.js @@ -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!' }); })