aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/utils/videos/videos.ts
diff options
context:
space:
mode:
Diffstat (limited to 'shared/utils/videos/videos.ts')
-rw-r--r--shared/utils/videos/videos.ts19
1 files changed, 17 insertions, 2 deletions
diff --git a/shared/utils/videos/videos.ts b/shared/utils/videos/videos.ts
index 0cf6e7c4f..39c808d1f 100644
--- a/shared/utils/videos/videos.ts
+++ b/shared/utils/videos/videos.ts
@@ -28,6 +28,7 @@ type VideoAttributes = {
28 language?: string 28 language?: string
29 nsfw?: boolean 29 nsfw?: boolean
30 commentsEnabled?: boolean 30 commentsEnabled?: boolean
31 downloadEnabled?: boolean
31 waitTranscoding?: boolean 32 waitTranscoding?: boolean
32 description?: string 33 description?: string
33 tags?: string[] 34 tags?: string[]
@@ -271,7 +272,16 @@ function removeVideo (url: string, token: string, id: number | string, expectedS
271async function checkVideoFilesWereRemoved ( 272async function checkVideoFilesWereRemoved (
272 videoUUID: string, 273 videoUUID: string,
273 serverNumber: number, 274 serverNumber: number,
274 directories = [ 'redundancy', 'videos', 'thumbnails', 'torrents', 'previews', 'captions' ] 275 directories = [
276 'redundancy',
277 'videos',
278 'thumbnails',
279 'torrents',
280 'previews',
281 'captions',
282 join('playlists', 'hls'),
283 join('redundancy', 'hls')
284 ]
275) { 285) {
276 const testDirectory = 'test' + serverNumber 286 const testDirectory = 'test' + serverNumber
277 287
@@ -279,7 +289,7 @@ async function checkVideoFilesWereRemoved (
279 const directoryPath = join(root(), testDirectory, directory) 289 const directoryPath = join(root(), testDirectory, directory)
280 290
281 const directoryExists = existsSync(directoryPath) 291 const directoryExists = existsSync(directoryPath)
282 expect(directoryExists).to.be.true 292 if (!directoryExists) continue
283 293
284 const files = await readdir(directoryPath) 294 const files = await readdir(directoryPath)
285 for (const file of files) { 295 for (const file of files) {
@@ -311,6 +321,7 @@ async function uploadVideo (url: string, accessToken: string, videoAttributesArg
311 tags: [ 'tag' ], 321 tags: [ 'tag' ],
312 privacy: VideoPrivacy.PUBLIC, 322 privacy: VideoPrivacy.PUBLIC,
313 commentsEnabled: true, 323 commentsEnabled: true,
324 downloadEnabled: true,
314 fixture: 'video_short.webm' 325 fixture: 'video_short.webm'
315 }, videoAttributesArg) 326 }, videoAttributesArg)
316 327
@@ -321,6 +332,7 @@ async function uploadVideo (url: string, accessToken: string, videoAttributesArg
321 .field('name', attributes.name) 332 .field('name', attributes.name)
322 .field('nsfw', JSON.stringify(attributes.nsfw)) 333 .field('nsfw', JSON.stringify(attributes.nsfw))
323 .field('commentsEnabled', JSON.stringify(attributes.commentsEnabled)) 334 .field('commentsEnabled', JSON.stringify(attributes.commentsEnabled))
335 .field('downloadEnabled', JSON.stringify(attributes.downloadEnabled))
324 .field('waitTranscoding', JSON.stringify(attributes.waitTranscoding)) 336 .field('waitTranscoding', JSON.stringify(attributes.waitTranscoding))
325 .field('privacy', attributes.privacy.toString()) 337 .field('privacy', attributes.privacy.toString())
326 .field('channelId', attributes.channelId) 338 .field('channelId', attributes.channelId)
@@ -371,6 +383,7 @@ function updateVideo (url: string, accessToken: string, id: number | string, att
371 if (attributes.language) body['language'] = attributes.language 383 if (attributes.language) body['language'] = attributes.language
372 if (attributes.nsfw !== undefined) body['nsfw'] = JSON.stringify(attributes.nsfw) 384 if (attributes.nsfw !== undefined) body['nsfw'] = JSON.stringify(attributes.nsfw)
373 if (attributes.commentsEnabled !== undefined) body['commentsEnabled'] = JSON.stringify(attributes.commentsEnabled) 385 if (attributes.commentsEnabled !== undefined) body['commentsEnabled'] = JSON.stringify(attributes.commentsEnabled)
386 if (attributes.downloadEnabled !== undefined) body['downloadEnabled'] = JSON.stringify(attributes.downloadEnabled)
374 if (attributes.description) body['description'] = attributes.description 387 if (attributes.description) body['description'] = attributes.description
375 if (attributes.tags) body['tags'] = attributes.tags 388 if (attributes.tags) body['tags'] = attributes.tags
376 if (attributes.privacy) body['privacy'] = attributes.privacy 389 if (attributes.privacy) body['privacy'] = attributes.privacy
@@ -436,6 +449,7 @@ async function completeVideoCheck (
436 language: string 449 language: string
437 nsfw: boolean 450 nsfw: boolean
438 commentsEnabled: boolean 451 commentsEnabled: boolean
452 downloadEnabled: boolean
439 description: string 453 description: string
440 publishedAt?: string 454 publishedAt?: string
441 support: string 455 support: string
@@ -510,6 +524,7 @@ async function completeVideoCheck (
510 expect(dateIsValid(videoDetails.channel.createdAt.toString())).to.be.true 524 expect(dateIsValid(videoDetails.channel.createdAt.toString())).to.be.true
511 expect(dateIsValid(videoDetails.channel.updatedAt.toString())).to.be.true 525 expect(dateIsValid(videoDetails.channel.updatedAt.toString())).to.be.true
512 expect(videoDetails.commentsEnabled).to.equal(attributes.commentsEnabled) 526 expect(videoDetails.commentsEnabled).to.equal(attributes.commentsEnabled)
527 expect(videoDetails.downloadEnabled).to.equal(attributes.downloadEnabled)
513 528
514 for (const attributeFile of attributes.files) { 529 for (const attributeFile of attributes.files) {
515 const file = videoDetails.files.find(f => f.resolution.id === attributeFile.resolution) 530 const file = videoDetails.files.find(f => f.resolution.id === attributeFile.resolution)