From 961cbe4269e5f34639e29310fb3d90a6cb1bd6bc Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 22 Apr 2022 09:50:20 +0200 Subject: Fix getting live by anonymous user --- server/models/video/video-live.ts | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'server/models') diff --git a/server/models/video/video-live.ts b/server/models/video/video-live.ts index 96c0bf7f7..68e381105 100644 --- a/server/models/video/video-live.ts +++ b/server/models/video/video-live.ts @@ -101,21 +101,28 @@ export class VideoLiveModel extends Model return VideoLiveModel.findOne(query) } - toFormattedJSON (): LiveVideo { - let rtmpUrl: string = null - let rtmpsUrl: string = null + toFormattedJSON (canSeePrivateInformation: boolean): LiveVideo { + let privateInformation: Pick | {} = {} // If we don't have a stream key, it means this is a remote live so we don't specify the rtmp URL - if (this.streamKey) { - if (CONFIG.LIVE.RTMP.ENABLED) rtmpUrl = WEBSERVER.RTMP_URL - if (CONFIG.LIVE.RTMPS.ENABLED) rtmpsUrl = WEBSERVER.RTMPS_URL + // We also display these private information only to the live owne/moderators + if (this.streamKey && canSeePrivateInformation === true) { + privateInformation = { + streamKey: this.streamKey, + + rtmpUrl: CONFIG.LIVE.RTMP.ENABLED + ? WEBSERVER.RTMP_URL + : null, + + rtmpsUrl: CONFIG.LIVE.RTMPS.ENABLED + ? WEBSERVER.RTMPS_URL + : null + } } return { - rtmpUrl, - rtmpsUrl, + ...privateInformation, - streamKey: this.streamKey, permanentLive: this.permanentLive, saveReplay: this.saveReplay, latencyMode: this.latencyMode -- cgit v1.2.3