X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Flib%2Fredis.ts;h=4325598b2f3df6c2cf35adfcfb1ff3447c08ab9a;hb=992f498e312efcde46f818ba719b50f1f958272f;hp=a075eee2d900e9765f96d04578e2a167ecb90db4;hpb=e9c5f123383e461a890c95368dce6f79d3b84660;p=github%2FChocobozzz%2FPeerTube.git 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) {