1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-04 02:09:37 +02:00

Handle views for live videos

This commit is contained in:
Chocobozzz 2020-11-06 16:42:23 +01:00 committed by Chocobozzz
parent 529f037294
commit e4bf785617
7 changed files with 190 additions and 24 deletions

View file

@ -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) {