aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api')
-rw-r--r--server/tests/api/object-storage/video-static-file-privacy.ts36
-rw-r--r--server/tests/api/videos/video-static-file-privacy.ts61
2 files changed, 95 insertions, 2 deletions
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 62edd10ba..71ad35a43 100644
--- a/server/tests/api/object-storage/video-static-file-privacy.ts
+++ b/server/tests/api/object-storage/video-static-file-privacy.ts
@@ -2,7 +2,7 @@
2 2
3import { expect } from 'chai' 3import { expect } from 'chai'
4import { basename } from 'path' 4import { basename } from 'path'
5import { expectStartWith } from '@server/tests/shared' 5import { checkVideoFileTokenReinjection, expectStartWith } from '@server/tests/shared'
6import { areScalewayObjectStorageTestsDisabled, getAllFiles, getHLS } from '@shared/core-utils' 6import { areScalewayObjectStorageTestsDisabled, getAllFiles, getHLS } from '@shared/core-utils'
7import { HttpStatusCode, LiveVideo, VideoDetails, VideoPrivacy } from '@shared/models' 7import { HttpStatusCode, LiveVideo, VideoDetails, VideoPrivacy } from '@shared/models'
8import { 8import {
@@ -191,6 +191,20 @@ describe('Object storage for video static file privacy', function () {
191 } 191 }
192 }) 192 })
193 193
194 it('Should reinject video file token', async function () {
195 this.timeout(120000)
196
197 const videoFileToken = await server.videoToken.getVideoFileToken({ videoId: privateVideoUUID })
198
199 await checkVideoFileTokenReinjection({
200 server,
201 videoUUID: privateVideoUUID,
202 videoFileToken,
203 resolutions: [ 240, 720 ],
204 isLive: false
205 })
206 })
207
194 it('Should update public video to private', async function () { 208 it('Should update public video to private', async function () {
195 this.timeout(60000) 209 this.timeout(60000)
196 210
@@ -315,6 +329,26 @@ describe('Object storage for video static file privacy', function () {
315 await checkLiveFiles(permanentLive, permanentLiveId) 329 await checkLiveFiles(permanentLive, permanentLiveId)
316 }) 330 })
317 331
332 it('Should reinject video file token in permanent live', async function () {
333 this.timeout(240000)
334
335 const ffmpegCommand = sendRTMPStream({ rtmpBaseUrl: permanentLive.rtmpUrl, streamKey: permanentLive.streamKey })
336 await server.live.waitUntilPublished({ videoId: permanentLiveId })
337
338 const video = await server.videos.getWithToken({ id: permanentLiveId })
339 const videoFileToken = await server.videoToken.getVideoFileToken({ videoId: video.uuid })
340
341 await checkVideoFileTokenReinjection({
342 server,
343 videoUUID: permanentLiveId,
344 videoFileToken,
345 resolutions: [ 720 ],
346 isLive: true
347 })
348
349 await stopFfmpeg(ffmpegCommand)
350 })
351
318 it('Should have created a replay of the normal live with a private static path', async function () { 352 it('Should have created a replay of the normal live with a private static path', async function () {
319 this.timeout(240000) 353 this.timeout(240000)
320 354
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
3import { expect } from 'chai' 3import { expect } from 'chai'
4import { decode } from 'magnet-uri' 4import { decode } from 'magnet-uri'
5import { expectStartWith } from '@server/tests/shared' 5import { checkVideoFileTokenReinjection, expectStartWith } from '@server/tests/shared'
6import { getAllFiles, wait } from '@shared/core-utils' 6import { getAllFiles, wait } from '@shared/core-utils'
7import { HttpStatusCode, LiveVideo, VideoDetails, VideoPrivacy } from '@shared/models' 7import { HttpStatusCode, LiveVideo, VideoDetails, VideoPrivacy } from '@shared/models'
8import { 8import {
@@ -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