diff options
Diffstat (limited to 'server/tests/api/videos/video-static-file-privacy.ts')
-rw-r--r-- | server/tests/api/videos/video-static-file-privacy.ts | 61 |
1 files changed, 60 insertions, 1 deletions
diff --git a/server/tests/api/videos/video-static-file-privacy.ts b/server/tests/api/videos/video-static-file-privacy.ts index eaaed5aad..ef0774b41 100644 --- a/server/tests/api/videos/video-static-file-privacy.ts +++ b/server/tests/api/videos/video-static-file-privacy.ts | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | import { expect } from 'chai' | 3 | import { expect } from 'chai' |
4 | import { decode } from 'magnet-uri' | 4 | import { decode } from 'magnet-uri' |
5 | import { expectStartWith } from '@server/tests/shared' | 5 | import { checkVideoFileTokenReinjection, expectStartWith } from '@server/tests/shared' |
6 | import { getAllFiles, wait } from '@shared/core-utils' | 6 | import { getAllFiles, wait } from '@shared/core-utils' |
7 | import { HttpStatusCode, LiveVideo, VideoDetails, VideoPrivacy } from '@shared/models' | 7 | import { HttpStatusCode, LiveVideo, VideoDetails, VideoPrivacy } from '@shared/models' |
8 | import { | 8 | import { |
@@ -248,6 +248,35 @@ describe('Test video static file privacy', function () { | |||
248 | await checkVideoFiles({ id: uuid, expectedStatus: HttpStatusCode.OK_200, token: server.accessToken, videoFileToken }) | 248 | await checkVideoFiles({ id: uuid, expectedStatus: HttpStatusCode.OK_200, token: server.accessToken, videoFileToken }) |
249 | }) | 249 | }) |
250 | 250 | ||
251 | it('Should reinject video file token', async function () { | ||
252 | this.timeout(120000) | ||
253 | |||
254 | const { uuid } = await server.videos.quickUpload({ name: 'video', privacy: VideoPrivacy.PRIVATE }) | ||
255 | |||
256 | const videoFileToken = await server.videoToken.getVideoFileToken({ videoId: uuid }) | ||
257 | await waitJobs([ server ]) | ||
258 | |||
259 | const video = await server.videos.getWithToken({ id: uuid }) | ||
260 | const hls = video.streamingPlaylists[0] | ||
261 | |||
262 | { | ||
263 | const query = { videoFileToken } | ||
264 | const { text } = await makeRawRequest({ url: hls.playlistUrl, query, expectedStatus: HttpStatusCode.OK_200 }) | ||
265 | |||
266 | expect(text).to.not.include(videoFileToken) | ||
267 | } | ||
268 | |||
269 | { | ||
270 | await checkVideoFileTokenReinjection({ | ||
271 | server, | ||
272 | videoUUID: uuid, | ||
273 | videoFileToken, | ||
274 | resolutions: [ 240, 720 ], | ||
275 | isLive: false | ||
276 | }) | ||
277 | } | ||
278 | }) | ||
279 | |||
251 | it('Should be able to access a private video of another user with an admin OAuth token or file token', async function () { | 280 | it('Should be able to access a private video of another user with an admin OAuth token or file token', async function () { |
252 | this.timeout(120000) | 281 | this.timeout(120000) |
253 | 282 | ||
@@ -360,6 +389,36 @@ describe('Test video static file privacy', function () { | |||
360 | await checkLiveFiles(permanentLive, permanentLiveId) | 389 | await checkLiveFiles(permanentLive, permanentLiveId) |
361 | }) | 390 | }) |
362 | 391 | ||
392 | it('Should reinject video file token on permanent live', async function () { | ||
393 | this.timeout(240000) | ||
394 | |||
395 | const ffmpegCommand = sendRTMPStream({ rtmpBaseUrl: permanentLive.rtmpUrl, streamKey: permanentLive.streamKey }) | ||
396 | await server.live.waitUntilPublished({ videoId: permanentLiveId }) | ||
397 | |||
398 | const video = await server.videos.getWithToken({ id: permanentLiveId }) | ||
399 | const videoFileToken = await server.videoToken.getVideoFileToken({ videoId: video.uuid }) | ||
400 | const hls = video.streamingPlaylists[0] | ||
401 | |||
402 | { | ||
403 | const query = { videoFileToken } | ||
404 | const { text } = await makeRawRequest({ url: hls.playlistUrl, query, expectedStatus: HttpStatusCode.OK_200 }) | ||
405 | |||
406 | expect(text).to.not.include(videoFileToken) | ||
407 | } | ||
408 | |||
409 | { | ||
410 | await checkVideoFileTokenReinjection({ | ||
411 | server, | ||
412 | videoUUID: permanentLiveId, | ||
413 | videoFileToken, | ||
414 | resolutions: [ 720 ], | ||
415 | isLive: true | ||
416 | }) | ||
417 | } | ||
418 | |||
419 | await stopFfmpeg(ffmpegCommand) | ||
420 | }) | ||
421 | |||
363 | it('Should have created a replay of the normal live with a private static path', async function () { | 422 | it('Should have created a replay of the normal live with a private static path', async function () { |
364 | this.timeout(240000) | 423 | this.timeout(240000) |
365 | 424 | ||