diff options
author | Chocobozzz <me@florianbigard.com> | 2022-04-22 09:50:20 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-04-22 09:50:20 +0200 |
commit | 961cbe4269e5f34639e29310fb3d90a6cb1bd6bc (patch) | |
tree | 06404c72c25a95238e7ef8a6bdfcb90d40c8649c /server/models/video | |
parent | 4ec52d04dcc5d664612331f8e08d7d90da990415 (diff) | |
download | PeerTube-961cbe4269e5f34639e29310fb3d90a6cb1bd6bc.tar.gz PeerTube-961cbe4269e5f34639e29310fb3d90a6cb1bd6bc.tar.zst PeerTube-961cbe4269e5f34639e29310fb3d90a6cb1bd6bc.zip |
Fix getting live by anonymous user
Diffstat (limited to 'server/models/video')
-rw-r--r-- | server/models/video/video-live.ts | 25 |
1 files changed, 16 insertions, 9 deletions
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<Partial<AttributesOnly<VideoLiveModel> | |||
101 | return VideoLiveModel.findOne<MVideoLive>(query) | 101 | return VideoLiveModel.findOne<MVideoLive>(query) |
102 | } | 102 | } |
103 | 103 | ||
104 | toFormattedJSON (): LiveVideo { | 104 | toFormattedJSON (canSeePrivateInformation: boolean): LiveVideo { |
105 | let rtmpUrl: string = null | 105 | let privateInformation: Pick<LiveVideo, 'rtmpUrl' | 'rtmpsUrl' | 'streamKey'> | {} = {} |
106 | let rtmpsUrl: string = null | ||
107 | 106 | ||
108 | // If we don't have a stream key, it means this is a remote live so we don't specify the rtmp URL | 107 | // If we don't have a stream key, it means this is a remote live so we don't specify the rtmp URL |
109 | if (this.streamKey) { | 108 | // We also display these private information only to the live owne/moderators |
110 | if (CONFIG.LIVE.RTMP.ENABLED) rtmpUrl = WEBSERVER.RTMP_URL | 109 | if (this.streamKey && canSeePrivateInformation === true) { |
111 | if (CONFIG.LIVE.RTMPS.ENABLED) rtmpsUrl = WEBSERVER.RTMPS_URL | 110 | privateInformation = { |
111 | streamKey: this.streamKey, | ||
112 | |||
113 | rtmpUrl: CONFIG.LIVE.RTMP.ENABLED | ||
114 | ? WEBSERVER.RTMP_URL | ||
115 | : null, | ||
116 | |||
117 | rtmpsUrl: CONFIG.LIVE.RTMPS.ENABLED | ||
118 | ? WEBSERVER.RTMPS_URL | ||
119 | : null | ||
120 | } | ||
112 | } | 121 | } |
113 | 122 | ||
114 | return { | 123 | return { |
115 | rtmpUrl, | 124 | ...privateInformation, |
116 | rtmpsUrl, | ||
117 | 125 | ||
118 | streamKey: this.streamKey, | ||
119 | permanentLive: this.permanentLive, | 126 | permanentLive: this.permanentLive, |
120 | saveReplay: this.saveReplay, | 127 | saveReplay: this.saveReplay, |
121 | latencyMode: this.latencyMode | 128 | latencyMode: this.latencyMode |