Fix views system behind a proxy

This commit is contained in:
Chocobozzz 2018-03-28 14:51:50 +02:00
parent 45cd28b679
commit e33e7fc89e
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 1 additions and 1 deletions

View File

@ -353,7 +353,7 @@ function getVideo (req: express.Request, res: express.Response) {
async function viewVideo (req: express.Request, res: express.Response) { async function viewVideo (req: express.Request, res: express.Response) {
const videoInstance = res.locals.video const videoInstance = res.locals.video
const ip = req.ip const ip = req.headers['x-real-ip'] as string || req.ip
const exists = await Redis.Instance.isViewExists(ip, videoInstance.uuid) const exists = await Redis.Instance.isViewExists(ip, videoInstance.uuid)
if (exists) { if (exists) {
logger.debug('View for ip %s and video %s already exists.', ip, videoInstance.uuid) logger.debug('View for ip %s and video %s already exists.', ip, videoInstance.uuid)