mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-03 09:49:20 +02:00
Blocked users must not be able to live stream
This commit is contained in:
parent
5f09fde24e
commit
ba3820965f
2 changed files with 34 additions and 12 deletions
|
@ -18,7 +18,7 @@ import { VideoLiveSessionModel } from '@server/models/video/video-live-session.j
|
|||
import { VideoLiveModel } from '@server/models/video/video-live.js'
|
||||
import { VideoStreamingPlaylistModel } from '@server/models/video/video-streaming-playlist.js'
|
||||
import { VideoModel } from '@server/models/video/video.js'
|
||||
import { MVideo, MVideoLiveSession, MVideoLiveVideo, MVideoLiveVideoWithSetting } from '@server/types/models/index.js'
|
||||
import { MUser, MVideo, MVideoLiveSession, MVideoLiveVideo, MVideoLiveVideoWithSetting } from '@server/types/models/index.js'
|
||||
import {
|
||||
ffprobePromise,
|
||||
getVideoStreamBitrate,
|
||||
|
@ -250,6 +250,12 @@ class LiveManager {
|
|||
return this.abortSession(sessionId)
|
||||
}
|
||||
|
||||
const user = await UserModel.loadByLiveId(videoLive.id)
|
||||
if (user.blocked) {
|
||||
logger.warn('User is blocked. Refusing stream %s.', streamKey, lTags(sessionId, video.uuid))
|
||||
return this.abortSession(sessionId)
|
||||
}
|
||||
|
||||
if (this.videoSessions.has(video.uuid)) {
|
||||
logger.warn('Video %s has already a live session. Refusing stream %s.', video.uuid, streamKey, lTags(sessionId, video.uuid))
|
||||
return this.abortSession(sessionId)
|
||||
|
@ -295,6 +301,8 @@ class LiveManager {
|
|||
sessionId,
|
||||
videoLive,
|
||||
|
||||
user,
|
||||
|
||||
inputLocalUrl,
|
||||
inputPublicUrl,
|
||||
fps,
|
||||
|
@ -309,6 +317,8 @@ class LiveManager {
|
|||
sessionId: string
|
||||
videoLive: MVideoLiveVideoWithSetting
|
||||
|
||||
user: MUser
|
||||
|
||||
inputLocalUrl: string
|
||||
inputPublicUrl: string
|
||||
|
||||
|
@ -318,13 +328,12 @@ class LiveManager {
|
|||
allResolutions: number[]
|
||||
hasAudio: boolean
|
||||
}) {
|
||||
const { sessionId, videoLive } = options
|
||||
const { sessionId, videoLive, user } = options
|
||||
const videoUUID = videoLive.Video.uuid
|
||||
const localLTags = lTags(sessionId, videoUUID)
|
||||
|
||||
const liveSession = await this.saveStartingSession(videoLive)
|
||||
|
||||
const user = await UserModel.loadByLiveId(videoLive.id)
|
||||
LiveQuotaStore.Instance.addNewLive(user.id, sessionId)
|
||||
|
||||
const muxingSession = new MuxingSession({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue