X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=shared%2Fserver-commands%2Fvideos%2Flive-command.ts;h=73f4eefd331a94086c625b55b41c1898d0f6aeff;hb=81f14b911211be065448e92bcc253f470c5ff2a9;hp=3273e3a8fe8455460e582eebc03a0170362500f5;hpb=05a60d85997c108d39bcfb14f1ffd4c74f8b1e93;p=github%2FChocobozzz%2FPeerTube.git diff --git a/shared/server-commands/videos/live-command.ts b/shared/server-commands/videos/live-command.ts index 3273e3a8f..73f4eefd3 100644 --- a/shared/server-commands/videos/live-command.ts +++ b/shared/server-commands/videos/live-command.ts @@ -121,7 +121,7 @@ export class LiveCommand extends AbstractCommand { permanentLive: boolean privacy?: VideoPrivacy }) { - const { saveReplay, permanentLive, privacy } = options + const { saveReplay, permanentLive, privacy = VideoPrivacy.PUBLIC } = options const { uuid } = await this.create({ ...options, @@ -213,6 +213,7 @@ export class LiveCommand extends AbstractCommand { while (error) { try { + // Check fragment exists await this.getRawRequest({ ...options, @@ -224,12 +225,16 @@ export class LiveCommand extends AbstractCommand { const video = await server.videos.get({ id: videoUUID }) const hlsPlaylist = video.streamingPlaylists[0] - const shaBody = await server.streamingPlaylists.getSegmentSha256({ url: hlsPlaylist.segmentsSha256Url }) - + // Check SHA generation + const shaBody = await server.streamingPlaylists.getSegmentSha256({ url: hlsPlaylist.segmentsSha256Url, withRetry: objectStorage }) if (!shaBody[segmentName]) { throw new Error('Segment SHA does not exist') } + // Check fragment is in m3u8 playlist + const subPlaylist = await server.streamingPlaylists.get({ url: `${baseUrl}/${video.uuid}/${playlistNumber}.m3u8` }) + if (!subPlaylist.includes(segmentName)) throw new Error('Fragment does not exist in playlist') + error = false } catch { error = true