From e4bf78561763cd84d22ebceb6f371cccf9a356d8 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 6 Nov 2020 16:42:23 +0100 Subject: Handle views for live videos --- server/lib/redis.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'server/lib/redis.ts') diff --git a/server/lib/redis.ts b/server/lib/redis.ts index a075eee2d..4325598b2 100644 --- a/server/lib/redis.ts +++ b/server/lib/redis.ts @@ -7,7 +7,7 @@ import { USER_EMAIL_VERIFY_LIFETIME, USER_PASSWORD_RESET_LIFETIME, USER_PASSWORD_CREATE_LIFETIME, - VIDEO_VIEW_LIFETIME, + VIEW_LIFETIME, WEBSERVER, TRACKER_RATE_LIMITS } from '../initializers/constants' @@ -118,8 +118,12 @@ class Redis { /* ************ Views per IP ************ */ - setIPVideoView (ip: string, videoUUID: string) { - return this.setValue(this.generateViewKey(ip, videoUUID), '1', VIDEO_VIEW_LIFETIME) + setIPVideoView (ip: string, videoUUID: string, isLive: boolean) { + const lifetime = isLive + ? VIEW_LIFETIME.LIVE + : VIEW_LIFETIME.VIDEO + + return this.setValue(this.generateViewKey(ip, videoUUID), '1', lifetime) } async doesVideoIPViewExist (ip: string, videoUUID: string) { -- cgit v1.2.3