From 05a60d85997c108d39bcfb14f1ffd4c74f8b1e93 Mon Sep 17 00:00:00 2001 From: Wicklow <123956049+wickloww@users.noreply.github.com> Date: Fri, 31 Mar 2023 07:12:21 +0000 Subject: Feature/Add replay privacy (#5692) * Add replay settings feature * Fix replay settings behaviour * Fix tests * Fix tests * Fix tests * Update openapi doc and fix tests * Add tests and fix code * Models correction * Add migration and update controller and middleware * Add check params tests * Fix video live middleware * Updated code based on review comments --- server/tests/api/check-params/live.ts | 47 +++- server/tests/api/live/live-constraints.ts | 6 +- server/tests/api/live/live-fast-restream.ts | 1 + server/tests/api/live/live-save-replay.ts | 264 +++++++++++++++------ server/tests/api/live/live.ts | 13 +- .../tests/api/notifications/user-notifications.ts | 2 + server/tests/api/object-storage/live.ts | 1 + .../object-storage/video-static-file-privacy.ts | 12 +- .../tests/api/videos/video-static-file-privacy.ts | 12 +- 9 files changed, 272 insertions(+), 86 deletions(-) (limited to 'server/tests/api') diff --git a/server/tests/api/check-params/live.ts b/server/tests/api/check-params/live.ts index 2eff9414b..81f10ed8e 100644 --- a/server/tests/api/check-params/live.ts +++ b/server/tests/api/check-params/live.ts @@ -83,6 +83,7 @@ describe('Test video lives API validator', function () { privacy: VideoPrivacy.PUBLIC, channelId, saveReplay: false, + replaySettings: undefined, permanentLive: false, latencyMode: LiveVideoLatencyMode.DEFAULT } @@ -141,6 +142,12 @@ describe('Test video lives API validator', function () { await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) }) + it('Should fail with a bad privacy for replay settings', async function () { + const fields = { ...baseCorrectParams, replaySettings: { privacy: 5 } } + + await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) + }) + it('Should fail with another user channel', async function () { const user = { username: 'fake', @@ -256,7 +263,7 @@ describe('Test video lives API validator', function () { }) it('Should forbid to save replay if not enabled by the admin', async function () { - const fields = { ...baseCorrectParams, saveReplay: true } + const fields = { ...baseCorrectParams, saveReplay: true, replaySettings: { privacy: VideoPrivacy.PUBLIC } } await server.config.updateCustomSubConfig({ newConfig: { @@ -277,7 +284,7 @@ describe('Test video lives API validator', function () { }) it('Should allow to save replay if enabled by the admin', async function () { - const fields = { ...baseCorrectParams, saveReplay: true } + const fields = { ...baseCorrectParams, saveReplay: true, replaySettings: { privacy: VideoPrivacy.PUBLIC } } await server.config.updateCustomSubConfig({ newConfig: { @@ -464,6 +471,39 @@ describe('Test video lives API validator', function () { await command.update({ videoId: video.id, fields, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) }) + it('Should fail with a bad privacy for replay settings', async function () { + const fields = { saveReplay: true, replaySettings: { privacy: 5 } } + + await command.update({ videoId: video.id, fields, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) + }) + + it('Should fail with save replay enabled but without replay settings', async function () { + await server.config.updateCustomSubConfig({ + newConfig: { + live: { + enabled: true, + allowReplay: true + } + } + }) + + const fields = { saveReplay: true } + + await command.update({ videoId: video.id, fields, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) + }) + + it('Should fail with save replay disabled and replay settings', async function () { + const fields = { saveReplay: false, replaySettings: { privacy: VideoPrivacy.INTERNAL } } + + await command.update({ videoId: video.id, fields, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) + }) + + it('Should fail with only replay settings when save replay is disabled', async function () { + const fields = { replaySettings: { privacy: VideoPrivacy.INTERNAL } } + + await command.update({ videoId: video.id, fields, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) + }) + it('Should fail to set latency if the server does not allow it', async function () { const fields = { latencyMode: LiveVideoLatencyMode.HIGH_LATENCY } @@ -474,6 +514,9 @@ describe('Test video lives API validator', function () { await command.update({ videoId: video.id, fields: { saveReplay: false } }) await command.update({ videoId: video.uuid, fields: { saveReplay: false } }) await command.update({ videoId: video.shortUUID, fields: { saveReplay: false } }) + + await command.update({ videoId: video.id, fields: { saveReplay: true, replaySettings: { privacy: VideoPrivacy.PUBLIC } } }) + }) it('Should fail to update replay status if replay is not allowed on the instance', async function () { diff --git a/server/tests/api/live/live-constraints.ts b/server/tests/api/live/live-constraints.ts index c82585a9e..fabb8798d 100644 --- a/server/tests/api/live/live-constraints.ts +++ b/server/tests/api/live/live-constraints.ts @@ -24,10 +24,7 @@ describe('Test live constraints', function () { let userAccessToken: string let userChannelId: number - async function createLiveWrapper (options: { - replay: boolean - permanent: boolean - }) { + async function createLiveWrapper (options: { replay: boolean, permanent: boolean }) { const { replay, permanent } = options const liveAttributes = { @@ -35,6 +32,7 @@ describe('Test live constraints', function () { channelId: userChannelId, privacy: VideoPrivacy.PUBLIC, saveReplay: replay, + replaySettings: options.replay ? { privacy: VideoPrivacy.PUBLIC } : undefined, permanentLive: permanent } diff --git a/server/tests/api/live/live-fast-restream.ts b/server/tests/api/live/live-fast-restream.ts index 9e6d10dbd..4e30feaef 100644 --- a/server/tests/api/live/live-fast-restream.ts +++ b/server/tests/api/live/live-fast-restream.ts @@ -23,6 +23,7 @@ describe('Fast restream in live', function () { privacy: VideoPrivacy.PUBLIC, name: 'my super live', saveReplay: options.replay, + replaySettings: options.replay ? { privacy: VideoPrivacy.PUBLIC } : undefined, permanentLive: options.permanent } diff --git a/server/tests/api/live/live-save-replay.ts b/server/tests/api/live/live-save-replay.ts index 8f17b4566..3a9a84f7e 100644 --- a/server/tests/api/live/live-save-replay.ts +++ b/server/tests/api/live/live-save-replay.ts @@ -27,7 +27,7 @@ describe('Save replay setting', function () { let liveVideoUUID: string let ffmpegCommand: FfmpegCommand - async function createLiveWrapper (options: { permanent: boolean, replay: boolean }) { + async function createLiveWrapper (options: { permanent: boolean, replay: boolean, replaySettings?: { privacy: VideoPrivacy } }) { if (liveVideoUUID) { try { await servers[0].videos.remove({ id: liveVideoUUID }) @@ -40,6 +40,7 @@ describe('Save replay setting', function () { privacy: VideoPrivacy.PUBLIC, name: 'my super live', saveReplay: options.replay, + replaySettings: options.replaySettings, permanentLive: options.permanent } @@ -47,7 +48,7 @@ describe('Save replay setting', function () { return uuid } - async function publishLive (options: { permanent: boolean, replay: boolean }) { + async function publishLive (options: { permanent: boolean, replay: boolean, replaySettings?: { privacy: VideoPrivacy } }) { liveVideoUUID = await createLiveWrapper(options) const ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: liveVideoUUID }) @@ -61,7 +62,7 @@ describe('Save replay setting', function () { return { ffmpegCommand, liveDetails } } - async function publishLiveAndDelete (options: { permanent: boolean, replay: boolean }) { + async function publishLiveAndDelete (options: { permanent: boolean, replay: boolean, replaySettings?: { privacy: VideoPrivacy } }) { const { ffmpegCommand, liveDetails } = await publishLive(options) await Promise.all([ @@ -76,7 +77,7 @@ describe('Save replay setting', function () { return { liveDetails } } - async function publishLiveAndBlacklist (options: { permanent: boolean, replay: boolean }) { + async function publishLiveAndBlacklist (options: { permanent: boolean, replay: boolean, replaySettings?: { privacy: VideoPrivacy } }) { const { ffmpegCommand, liveDetails } = await publishLive(options) await Promise.all([ @@ -112,6 +113,13 @@ describe('Save replay setting', function () { } } + async function checkVideoPrivacy (videoId: string, privacy: VideoPrivacy) { + for (const server of servers) { + const video = await server.videos.get({ id: videoId }) + expect(video.privacy.id).to.equal(privacy) + } + } + before(async function () { this.timeout(120000) @@ -247,12 +255,13 @@ describe('Save replay setting', function () { it('Should correctly create and federate the "waiting for stream" live', async function () { this.timeout(20000) - liveVideoUUID = await createLiveWrapper({ permanent: false, replay: true }) + liveVideoUUID = await createLiveWrapper({ permanent: false, replay: true, replaySettings: { privacy: VideoPrivacy.UNLISTED } }) await waitJobs(servers) await checkVideosExist(liveVideoUUID, false, HttpStatusCode.OK_200) await checkVideoState(liveVideoUUID, VideoState.WAITING_FOR_LIVE) + await checkVideoPrivacy(liveVideoUUID, VideoPrivacy.PUBLIC) }) it('Should correctly have updated the live and federated it when streaming in the live', async function () { @@ -265,6 +274,7 @@ describe('Save replay setting', function () { await checkVideosExist(liveVideoUUID, true, HttpStatusCode.OK_200) await checkVideoState(liveVideoUUID, VideoState.PUBLISHED) + await checkVideoPrivacy(liveVideoUUID, VideoPrivacy.PUBLIC) }) it('Should correctly have saved the live and federated it after the streaming', async function () { @@ -274,6 +284,8 @@ describe('Save replay setting', function () { expect(session.endDate).to.not.exist expect(session.endingProcessed).to.be.false expect(session.saveReplay).to.be.true + expect(session.replaySettings).to.exist + expect(session.replaySettings.privacy).to.equal(VideoPrivacy.UNLISTED) await stopFfmpeg(ffmpegCommand) @@ -281,8 +293,9 @@ describe('Save replay setting', function () { await waitJobs(servers) // Live has been transcoded - await checkVideosExist(liveVideoUUID, true, HttpStatusCode.OK_200) + await checkVideosExist(liveVideoUUID, false, HttpStatusCode.OK_200) await checkVideoState(liveVideoUUID, VideoState.PUBLISHED) + await checkVideoPrivacy(liveVideoUUID, VideoPrivacy.UNLISTED) }) it('Should find the replay live session', async function () { @@ -296,6 +309,8 @@ describe('Save replay setting', function () { expect(session.error).to.not.exist expect(session.saveReplay).to.be.true expect(session.endingProcessed).to.be.true + expect(session.replaySettings).to.exist + expect(session.replaySettings.privacy).to.equal(VideoPrivacy.UNLISTED) expect(session.replayVideo).to.exist expect(session.replayVideo.id).to.exist @@ -306,13 +321,14 @@ describe('Save replay setting', function () { it('Should update the saved live and correctly federate the updated attributes', async function () { this.timeout(30000) - await servers[0].videos.update({ id: liveVideoUUID, attributes: { name: 'video updated' } }) + await servers[0].videos.update({ id: liveVideoUUID, attributes: { name: 'video updated', privacy: VideoPrivacy.PUBLIC } }) await waitJobs(servers) for (const server of servers) { const video = await server.videos.get({ id: liveVideoUUID }) expect(video.name).to.equal('video updated') expect(video.isLive).to.be.false + expect(video.privacy.id).to.equal(VideoPrivacy.PUBLIC) } }) @@ -323,7 +339,7 @@ describe('Save replay setting', function () { it('Should correctly terminate the stream on blacklist and blacklist the saved replay video', async function () { this.timeout(120000) - await publishLiveAndBlacklist({ permanent: false, replay: true }) + await publishLiveAndBlacklist({ permanent: false, replay: true, replaySettings: { privacy: VideoPrivacy.PUBLIC } }) await checkVideosExist(liveVideoUUID, false) @@ -338,7 +354,7 @@ describe('Save replay setting', function () { it('Should correctly terminate the stream on delete and delete the video', async function () { this.timeout(40000) - await publishLiveAndDelete({ permanent: false, replay: true }) + await publishLiveAndDelete({ permanent: false, replay: true, replaySettings: { privacy: VideoPrivacy.PUBLIC } }) await checkVideosExist(liveVideoUUID, false, HttpStatusCode.NOT_FOUND_404) await checkLiveCleanup({ server: servers[0], videoUUID: liveVideoUUID, permanent: false }) @@ -348,103 +364,201 @@ describe('Save replay setting', function () { describe('With save replay enabled on permanent live', function () { let lastReplayUUID: string - it('Should correctly create and federate the "waiting for stream" live', async function () { - this.timeout(20000) + describe('With a first live and its replay', function () { - liveVideoUUID = await createLiveWrapper({ permanent: true, replay: true }) + it('Should correctly create and federate the "waiting for stream" live', async function () { + this.timeout(20000) - await waitJobs(servers) + liveVideoUUID = await createLiveWrapper({ permanent: true, replay: true, replaySettings: { privacy: VideoPrivacy.UNLISTED } }) - await checkVideosExist(liveVideoUUID, false, HttpStatusCode.OK_200) - await checkVideoState(liveVideoUUID, VideoState.WAITING_FOR_LIVE) - }) + await waitJobs(servers) - it('Should correctly have updated the live and federated it when streaming in the live', async function () { - this.timeout(20000) + await checkVideosExist(liveVideoUUID, false, HttpStatusCode.OK_200) + await checkVideoState(liveVideoUUID, VideoState.WAITING_FOR_LIVE) + await checkVideoPrivacy(liveVideoUUID, VideoPrivacy.PUBLIC) + }) - ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: liveVideoUUID }) - await waitUntilLivePublishedOnAllServers(servers, liveVideoUUID) + it('Should correctly have updated the live and federated it when streaming in the live', async function () { + this.timeout(20000) - await waitJobs(servers) + ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: liveVideoUUID }) + await waitUntilLivePublishedOnAllServers(servers, liveVideoUUID) - await checkVideosExist(liveVideoUUID, true, HttpStatusCode.OK_200) - await checkVideoState(liveVideoUUID, VideoState.PUBLISHED) - }) + await waitJobs(servers) - it('Should correctly have saved the live and federated it after the streaming', async function () { - this.timeout(30000) + await checkVideosExist(liveVideoUUID, true, HttpStatusCode.OK_200) + await checkVideoState(liveVideoUUID, VideoState.PUBLISHED) + await checkVideoPrivacy(liveVideoUUID, VideoPrivacy.PUBLIC) + }) - const liveDetails = await servers[0].videos.get({ id: liveVideoUUID }) + it('Should correctly have saved the live and federated it after the streaming', async function () { + this.timeout(30000) - await stopFfmpeg(ffmpegCommand) + const liveDetails = await servers[0].videos.get({ id: liveVideoUUID }) - await waitUntilLiveWaitingOnAllServers(servers, liveVideoUUID) - await waitJobs(servers) + await stopFfmpeg(ffmpegCommand) - const video = await findExternalSavedVideo(servers[0], liveDetails) - expect(video).to.exist + await waitUntilLiveWaitingOnAllServers(servers, liveVideoUUID) + await waitJobs(servers) - for (const server of servers) { - await server.videos.get({ id: video.uuid }) - } + const video = await findExternalSavedVideo(servers[0], liveDetails) + expect(video).to.exist - lastReplayUUID = video.uuid - }) + for (const server of servers) { + await server.videos.get({ id: video.uuid }) + } - it('Should have appropriate ended session and replay live session', async function () { - const { data, total } = await servers[0].live.listSessions({ videoId: liveVideoUUID }) - expect(total).to.equal(1) - expect(data).to.have.lengthOf(1) + lastReplayUUID = video.uuid + }) - const sessionFromLive = data[0] - const sessionFromReplay = await servers[0].live.getReplaySession({ videoId: lastReplayUUID }) + it('Should have appropriate ended session and replay live session', async function () { + const { data, total } = await servers[0].live.listSessions({ videoId: liveVideoUUID }) + expect(total).to.equal(1) + expect(data).to.have.lengthOf(1) - for (const session of [ sessionFromLive, sessionFromReplay ]) { - expect(session.startDate).to.exist - expect(session.endDate).to.exist + const sessionFromLive = data[0] + const sessionFromReplay = await servers[0].live.getReplaySession({ videoId: lastReplayUUID }) - expect(session.error).to.not.exist + for (const session of [ sessionFromLive, sessionFromReplay ]) { + expect(session.startDate).to.exist + expect(session.endDate).to.exist - expect(session.replayVideo).to.exist - expect(session.replayVideo.id).to.exist - expect(session.replayVideo.shortUUID).to.exist - expect(session.replayVideo.uuid).to.equal(lastReplayUUID) - } - }) + expect(session.replaySettings).to.exist + expect(session.replaySettings.privacy).to.equal(VideoPrivacy.UNLISTED) - it('Should have cleaned up the live files', async function () { - await checkLiveCleanup({ server: servers[0], videoUUID: liveVideoUUID, permanent: false }) + expect(session.error).to.not.exist + + expect(session.replayVideo).to.exist + expect(session.replayVideo.id).to.exist + expect(session.replayVideo.shortUUID).to.exist + expect(session.replayVideo.uuid).to.equal(lastReplayUUID) + } + }) + + it('Should have the first live replay with correct settings', async function () { + await checkVideosExist(lastReplayUUID, false, HttpStatusCode.OK_200) + await checkVideoState(lastReplayUUID, VideoState.PUBLISHED) + await checkVideoPrivacy(lastReplayUUID, VideoPrivacy.UNLISTED) + }) }) - it('Should correctly terminate the stream on blacklist and blacklist the saved replay video', async function () { - this.timeout(120000) + describe('With a second live and its replay', function () { + it('Should update the replay settings', async function () { + await servers[0].live.update( + { videoId: liveVideoUUID, fields: { replaySettings: { privacy: VideoPrivacy.PUBLIC } } }) + await waitJobs(servers) + const live = await servers[0].live.get({ videoId: liveVideoUUID }) - await servers[0].videos.remove({ id: lastReplayUUID }) - const { liveDetails } = await publishLiveAndBlacklist({ permanent: true, replay: true }) + expect(live.saveReplay).to.be.true + expect(live.replaySettings).to.exist + expect(live.replaySettings.privacy).to.equal(VideoPrivacy.PUBLIC) - const replay = await findExternalSavedVideo(servers[0], liveDetails) - expect(replay).to.exist + }) - for (const videoId of [ liveVideoUUID, replay.uuid ]) { - await checkVideosExist(videoId, false) + it('Should correctly have updated the live and federated it when streaming in the live', async function () { + this.timeout(20000) - await servers[0].videos.get({ id: videoId, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 }) - await servers[1].videos.get({ id: videoId, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) - } + ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: liveVideoUUID }) + await waitUntilLivePublishedOnAllServers(servers, liveVideoUUID) - await checkLiveCleanup({ server: servers[0], videoUUID: liveVideoUUID, permanent: false }) - }) + await waitJobs(servers) - it('Should correctly terminate the stream on delete and not save the video', async function () { - this.timeout(40000) + await checkVideosExist(liveVideoUUID, true, HttpStatusCode.OK_200) + await checkVideoState(liveVideoUUID, VideoState.PUBLISHED) + await checkVideoPrivacy(liveVideoUUID, VideoPrivacy.PUBLIC) + }) - const { liveDetails } = await publishLiveAndDelete({ permanent: true, replay: true }) + it('Should correctly have saved the live and federated it after the streaming', async function () { + this.timeout(30000) + const liveDetails = await servers[0].videos.get({ id: liveVideoUUID }) - const replay = await findExternalSavedVideo(servers[0], liveDetails) - expect(replay).to.not.exist + await stopFfmpeg(ffmpegCommand) - await checkVideosExist(liveVideoUUID, false, HttpStatusCode.NOT_FOUND_404) - await checkLiveCleanup({ server: servers[0], videoUUID: liveVideoUUID, permanent: false }) + await waitUntilLiveWaitingOnAllServers(servers, liveVideoUUID) + await waitJobs(servers) + + const video = await findExternalSavedVideo(servers[0], liveDetails) + expect(video).to.exist + + for (const server of servers) { + await server.videos.get({ id: video.uuid }) + } + + lastReplayUUID = video.uuid + }) + + it('Should have appropriate ended session and replay live session', async function () { + const { data, total } = await servers[0].live.listSessions({ videoId: liveVideoUUID }) + expect(total).to.equal(2) + expect(data).to.have.lengthOf(2) + + const sessionFromLive = data[1] + const sessionFromReplay = await servers[0].live.getReplaySession({ videoId: lastReplayUUID }) + + for (const session of [ sessionFromLive, sessionFromReplay ]) { + expect(session.startDate).to.exist + expect(session.endDate).to.exist + + expect(session.replaySettings).to.exist + expect(session.replaySettings.privacy).to.equal(VideoPrivacy.PUBLIC) + + expect(session.error).to.not.exist + + expect(session.replayVideo).to.exist + expect(session.replayVideo.id).to.exist + expect(session.replayVideo.shortUUID).to.exist + expect(session.replayVideo.uuid).to.equal(lastReplayUUID) + } + }) + + it('Should have the first live replay with correct settings', async function () { + await checkVideosExist(lastReplayUUID, true, HttpStatusCode.OK_200) + await checkVideoState(lastReplayUUID, VideoState.PUBLISHED) + await checkVideoPrivacy(lastReplayUUID, VideoPrivacy.PUBLIC) + }) + + it('Should have cleaned up the live files', async function () { + await checkLiveCleanup({ server: servers[0], videoUUID: liveVideoUUID, permanent: false }) + }) + + it('Should correctly terminate the stream on blacklist and blacklist the saved replay video', async function () { + this.timeout(120000) + + await servers[0].videos.remove({ id: lastReplayUUID }) + const { liveDetails } = await publishLiveAndBlacklist({ + permanent: true, + replay: true, + replaySettings: { privacy: VideoPrivacy.PUBLIC } + }) + + const replay = await findExternalSavedVideo(servers[0], liveDetails) + expect(replay).to.exist + + for (const videoId of [ liveVideoUUID, replay.uuid ]) { + await checkVideosExist(videoId, false) + + await servers[0].videos.get({ id: videoId, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 }) + await servers[1].videos.get({ id: videoId, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) + } + + await checkLiveCleanup({ server: servers[0], videoUUID: liveVideoUUID, permanent: false }) + }) + + it('Should correctly terminate the stream on delete and not save the video', async function () { + this.timeout(40000) + + const { liveDetails } = await publishLiveAndDelete({ + permanent: true, + replay: true, + replaySettings: { privacy: VideoPrivacy.PUBLIC } + }) + + const replay = await findExternalSavedVideo(servers[0], liveDetails) + expect(replay).to.not.exist + + await checkVideosExist(liveVideoUUID, false, HttpStatusCode.NOT_FOUND_404) + await checkLiveCleanup({ server: servers[0], videoUUID: liveVideoUUID, permanent: false }) + }) }) }) diff --git a/server/tests/api/live/live.ts b/server/tests/api/live/live.ts index 003cc934f..ceb606af1 100644 --- a/server/tests/api/live/live.ts +++ b/server/tests/api/live/live.ts @@ -87,6 +87,7 @@ describe('Test live', function () { commentsEnabled: false, downloadEnabled: false, saveReplay: true, + replaySettings: { privacy: VideoPrivacy.PUBLIC }, latencyMode: LiveVideoLatencyMode.SMALL_LATENCY, privacy: VideoPrivacy.PUBLIC, previewfile: 'video_short1-preview.webm.jpg', @@ -128,6 +129,9 @@ describe('Test live', function () { if (server.url === servers[0].url) { expect(live.rtmpUrl).to.equal('rtmp://' + server.hostname + ':' + servers[0].rtmpPort + '/live') expect(live.streamKey).to.not.be.empty + + expect(live.replaySettings).to.exist + expect(live.replaySettings.privacy).to.equal(VideoPrivacy.PUBLIC) } else { expect(live.rtmpUrl).to.not.exist expect(live.streamKey).to.not.exist @@ -196,6 +200,7 @@ describe('Test live', function () { } expect(live.saveReplay).to.be.false + expect(live.replaySettings).to.not.exist expect(live.latencyMode).to.equal(LiveVideoLatencyMode.DEFAULT) } }) @@ -366,7 +371,10 @@ describe('Test live', function () { name: 'live video', channelId: servers[0].store.channel.id, privacy: VideoPrivacy.PUBLIC, - saveReplay + saveReplay, + replaySettings: saveReplay + ? { privacy: VideoPrivacy.PUBLIC } + : undefined } const { uuid } = await commands[0].create({ fields: liveAttributes }) @@ -670,6 +678,9 @@ describe('Test live', function () { channelId: servers[0].store.channel.id, privacy: VideoPrivacy.PUBLIC, saveReplay: options.saveReplay, + replaySettings: options.saveReplay + ? { privacy: VideoPrivacy.PUBLIC } + : undefined, permanentLive: options.permanent } diff --git a/server/tests/api/notifications/user-notifications.ts b/server/tests/api/notifications/user-notifications.ts index f945cb6a8..7a8a234c2 100644 --- a/server/tests/api/notifications/user-notifications.ts +++ b/server/tests/api/notifications/user-notifications.ts @@ -342,6 +342,7 @@ describe('Test user notifications', function () { privacy: VideoPrivacy.PUBLIC, channelId: servers[1].store.channel.id, saveReplay: true, + replaySettings: { privacy: VideoPrivacy.PUBLIC }, permanentLive: false } }) @@ -367,6 +368,7 @@ describe('Test user notifications', function () { privacy: VideoPrivacy.PUBLIC, channelId: servers[1].store.channel.id, saveReplay: true, + replaySettings: { privacy: VideoPrivacy.PUBLIC }, permanentLive: true } }) diff --git a/server/tests/api/object-storage/live.ts b/server/tests/api/object-storage/live.ts index 2a3fc4779..588e0a8d7 100644 --- a/server/tests/api/object-storage/live.ts +++ b/server/tests/api/object-storage/live.ts @@ -27,6 +27,7 @@ async function createLive (server: PeerTubeServer, permanent: boolean) { privacy: VideoPrivacy.PUBLIC, name: 'my super live', saveReplay: true, + replaySettings: { privacy: VideoPrivacy.PUBLIC }, permanentLive: permanent } diff --git a/server/tests/api/object-storage/video-static-file-privacy.ts b/server/tests/api/object-storage/video-static-file-privacy.ts index 869d437d5..930c88543 100644 --- a/server/tests/api/object-storage/video-static-file-privacy.ts +++ b/server/tests/api/object-storage/video-static-file-privacy.ts @@ -305,13 +305,21 @@ describe('Object storage for video static file privacy', function () { }) { - const { video, live } = await server.live.quickCreate({ saveReplay: true, permanentLive: false, privacy: VideoPrivacy.PRIVATE }) + const { video, live } = await server.live.quickCreate({ + saveReplay: true, + permanentLive: false, + privacy: VideoPrivacy.PRIVATE + }) normalLiveId = video.uuid normalLive = live } { - const { video, live } = await server.live.quickCreate({ saveReplay: true, permanentLive: true, privacy: VideoPrivacy.PRIVATE }) + const { video, live } = await server.live.quickCreate({ + saveReplay: true, + permanentLive: true, + privacy: VideoPrivacy.PRIVATE + }) permanentLiveId = video.uuid permanentLive = live } diff --git a/server/tests/api/videos/video-static-file-privacy.ts b/server/tests/api/videos/video-static-file-privacy.ts index 16530884e..2dcfbbc57 100644 --- a/server/tests/api/videos/video-static-file-privacy.ts +++ b/server/tests/api/videos/video-static-file-privacy.ts @@ -364,13 +364,21 @@ describe('Test video static file privacy', function () { }) { - const { video, live } = await server.live.quickCreate({ saveReplay: true, permanentLive: false, privacy: VideoPrivacy.PRIVATE }) + const { video, live } = await server.live.quickCreate({ + saveReplay: true, + permanentLive: false, + privacy: VideoPrivacy.PRIVATE + }) normalLiveId = video.uuid normalLive = live } { - const { video, live } = await server.live.quickCreate({ saveReplay: true, permanentLive: true, privacy: VideoPrivacy.PRIVATE }) + const { video, live } = await server.live.quickCreate({ + saveReplay: true, + permanentLive: true, + privacy: VideoPrivacy.PRIVATE + }) permanentLiveId = video.uuid permanentLive = live } -- cgit v1.2.3