diff options
Diffstat (limited to 'server/lib/redis.ts')
-rw-r--r-- | server/lib/redis.ts | 10 |
1 files changed, 7 insertions, 3 deletions
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 { | |||
7 | USER_EMAIL_VERIFY_LIFETIME, | 7 | USER_EMAIL_VERIFY_LIFETIME, |
8 | USER_PASSWORD_RESET_LIFETIME, | 8 | USER_PASSWORD_RESET_LIFETIME, |
9 | USER_PASSWORD_CREATE_LIFETIME, | 9 | USER_PASSWORD_CREATE_LIFETIME, |
10 | VIDEO_VIEW_LIFETIME, | 10 | VIEW_LIFETIME, |
11 | WEBSERVER, | 11 | WEBSERVER, |
12 | TRACKER_RATE_LIMITS | 12 | TRACKER_RATE_LIMITS |
13 | } from '../initializers/constants' | 13 | } from '../initializers/constants' |
@@ -118,8 +118,12 @@ class Redis { | |||
118 | 118 | ||
119 | /* ************ Views per IP ************ */ | 119 | /* ************ Views per IP ************ */ |
120 | 120 | ||
121 | setIPVideoView (ip: string, videoUUID: string) { | 121 | setIPVideoView (ip: string, videoUUID: string, isLive: boolean) { |
122 | return this.setValue(this.generateViewKey(ip, videoUUID), '1', VIDEO_VIEW_LIFETIME) | 122 | const lifetime = isLive |
123 | ? VIEW_LIFETIME.LIVE | ||
124 | : VIEW_LIFETIME.VIDEO | ||
125 | |||
126 | return this.setValue(this.generateViewKey(ip, videoUUID), '1', lifetime) | ||
123 | } | 127 | } |
124 | 128 | ||
125 | async doesVideoIPViewExist (ip: string, videoUUID: string) { | 129 | async doesVideoIPViewExist (ip: string, videoUUID: string) { |