aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/initializers/constants.ts3
-rw-r--r--server/tests/api/check-params/live.ts8
-rw-r--r--server/tests/api/check-params/video-imports.ts8
-rw-r--r--server/tests/api/check-params/video-playlists.ts9
-rw-r--r--server/tests/api/check-params/videos.ts16
-rw-r--r--server/tests/fixtures/preview-big.pngbin0 -> 432157 bytes
6 files changed, 25 insertions, 19 deletions
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index c06eb6fb0..0b4b41273 100644
--- a/server/initializers/constants.ts
+++ b/server/initializers/constants.ts
@@ -274,8 +274,6 @@ const CONSTRAINTS_FIELDS = {
274 DURATION: { min: 0 }, // Number 274 DURATION: { min: 0 }, // Number
275 TAGS: { min: 0, max: 5 }, // Number of total tags 275 TAGS: { min: 0, max: 5 }, // Number of total tags
276 TAG: { min: 2, max: 30 }, // Length 276 TAG: { min: 2, max: 30 }, // Length
277 THUMBNAIL: { min: 2, max: 30 },
278 THUMBNAIL_DATA: { min: 0, max: 20000 }, // Bytes
279 VIEWS: { min: 0 }, 277 VIEWS: { min: 0 },
280 LIKES: { min: 0 }, 278 LIKES: { min: 0 },
281 DISLIKES: { min: 0 }, 279 DISLIKES: { min: 0 },
@@ -750,6 +748,7 @@ if (isTestInstance() === true) {
750 ACTIVITY_PUB.VIDEO_PLAYLIST_REFRESH_INTERVAL = 10 * 1000 // 10 seconds 748 ACTIVITY_PUB.VIDEO_PLAYLIST_REFRESH_INTERVAL = 10 * 1000 // 10 seconds
751 749
752 CONSTRAINTS_FIELDS.ACTORS.AVATAR.FILE_SIZE.max = 100 * 1024 // 100KB 750 CONSTRAINTS_FIELDS.ACTORS.AVATAR.FILE_SIZE.max = 100 * 1024 // 100KB
751 CONSTRAINTS_FIELDS.VIDEOS.IMAGE.FILE_SIZE.max = 400 * 1024 // 400KB
753 752
754 SCHEDULER_INTERVALS_MS.actorFollowScores = 1000 753 SCHEDULER_INTERVALS_MS.actorFollowScores = 1000
755 SCHEDULER_INTERVALS_MS.removeOldJobs = 10000 754 SCHEDULER_INTERVALS_MS.removeOldJobs = 10000
diff --git a/server/tests/api/check-params/live.ts b/server/tests/api/check-params/live.ts
index a5493572b..c171b1f81 100644
--- a/server/tests/api/check-params/live.ts
+++ b/server/tests/api/check-params/live.ts
@@ -180,7 +180,7 @@ describe('Test video lives API validator', function () {
180 it('Should fail with an incorrect thumbnail file', async function () { 180 it('Should fail with an incorrect thumbnail file', async function () {
181 const fields = baseCorrectParams 181 const fields = baseCorrectParams
182 const attaches = { 182 const attaches = {
183 thumbnailfile: join(__dirname, '..', '..', 'fixtures', 'avatar.png') 183 thumbnailfile: join(__dirname, '..', '..', 'fixtures', 'video_short.mp4')
184 } 184 }
185 185
186 await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) 186 await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches })
@@ -189,7 +189,7 @@ describe('Test video lives API validator', function () {
189 it('Should fail with a big thumbnail file', async function () { 189 it('Should fail with a big thumbnail file', async function () {
190 const fields = baseCorrectParams 190 const fields = baseCorrectParams
191 const attaches = { 191 const attaches = {
192 thumbnailfile: join(__dirname, '..', '..', 'fixtures', 'avatar-big.png') 192 thumbnailfile: join(__dirname, '..', '..', 'fixtures', 'preview-big.png')
193 } 193 }
194 194
195 await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) 195 await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches })
@@ -198,7 +198,7 @@ describe('Test video lives API validator', function () {
198 it('Should fail with an incorrect preview file', async function () { 198 it('Should fail with an incorrect preview file', async function () {
199 const fields = baseCorrectParams 199 const fields = baseCorrectParams
200 const attaches = { 200 const attaches = {
201 previewfile: join(__dirname, '..', '..', 'fixtures', 'avatar.png') 201 previewfile: join(__dirname, '..', '..', 'fixtures', 'video_short.mp4')
202 } 202 }
203 203
204 await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) 204 await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches })
@@ -207,7 +207,7 @@ describe('Test video lives API validator', function () {
207 it('Should fail with a big preview file', async function () { 207 it('Should fail with a big preview file', async function () {
208 const fields = baseCorrectParams 208 const fields = baseCorrectParams
209 const attaches = { 209 const attaches = {
210 previewfile: join(__dirname, '..', '..', 'fixtures', 'avatar-big.png') 210 previewfile: join(__dirname, '..', '..', 'fixtures', 'preview-big.png')
211 } 211 }
212 212
213 await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) 213 await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches })
diff --git a/server/tests/api/check-params/video-imports.ts b/server/tests/api/check-params/video-imports.ts
index 49ff96117..6de6b40c8 100644
--- a/server/tests/api/check-params/video-imports.ts
+++ b/server/tests/api/check-params/video-imports.ts
@@ -201,7 +201,7 @@ describe('Test video imports API validator', function () {
201 it('Should fail with an incorrect thumbnail file', async function () { 201 it('Should fail with an incorrect thumbnail file', async function () {
202 const fields = baseCorrectParams 202 const fields = baseCorrectParams
203 const attaches = { 203 const attaches = {
204 thumbnailfile: join(__dirname, '..', '..', 'fixtures', 'avatar.png') 204 thumbnailfile: join(__dirname, '..', '..', 'fixtures', 'video_short.mp4')
205 } 205 }
206 206
207 await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) 207 await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches })
@@ -210,7 +210,7 @@ describe('Test video imports API validator', function () {
210 it('Should fail with a big thumbnail file', async function () { 210 it('Should fail with a big thumbnail file', async function () {
211 const fields = baseCorrectParams 211 const fields = baseCorrectParams
212 const attaches = { 212 const attaches = {
213 thumbnailfile: join(__dirname, '..', '..', 'fixtures', 'avatar-big.png') 213 thumbnailfile: join(__dirname, '..', '..', 'fixtures', 'preview-big.png')
214 } 214 }
215 215
216 await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) 216 await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches })
@@ -219,7 +219,7 @@ describe('Test video imports API validator', function () {
219 it('Should fail with an incorrect preview file', async function () { 219 it('Should fail with an incorrect preview file', async function () {
220 const fields = baseCorrectParams 220 const fields = baseCorrectParams
221 const attaches = { 221 const attaches = {
222 previewfile: join(__dirname, '..', '..', 'fixtures', 'avatar.png') 222 previewfile: join(__dirname, '..', '..', 'fixtures', 'video_short.mp4')
223 } 223 }
224 224
225 await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) 225 await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches })
@@ -228,7 +228,7 @@ describe('Test video imports API validator', function () {
228 it('Should fail with a big preview file', async function () { 228 it('Should fail with a big preview file', async function () {
229 const fields = baseCorrectParams 229 const fields = baseCorrectParams
230 const attaches = { 230 const attaches = {
231 previewfile: join(__dirname, '..', '..', 'fixtures', 'avatar-big.png') 231 previewfile: join(__dirname, '..', '..', 'fixtures', 'preview-big.png')
232 } 232 }
233 233
234 await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) 234 await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches })
diff --git a/server/tests/api/check-params/video-playlists.ts b/server/tests/api/check-params/video-playlists.ts
index 418af05d1..bbea88354 100644
--- a/server/tests/api/check-params/video-playlists.ts
+++ b/server/tests/api/check-params/video-playlists.ts
@@ -251,7 +251,14 @@ describe('Test video playlists API validator', function () {
251 }) 251 })
252 252
253 it('Should fail with an incorrect thumbnail file', async function () { 253 it('Should fail with an incorrect thumbnail file', async function () {
254 const params = getBase({ thumbnailfile: 'avatar.png' }) 254 const params = getBase({ thumbnailfile: 'video_short.mp4' })
255
256 await createVideoPlaylist(params)
257 await updateVideoPlaylist(getUpdate(params, playlistUUID))
258 })
259
260 it('Should fail with a thumbnail file too big', async function () {
261 const params = getBase({ thumbnailfile: 'preview-big.png' })
255 262
256 await createVideoPlaylist(params) 263 await createVideoPlaylist(params)
257 await updateVideoPlaylist(getUpdate(params, playlistUUID)) 264 await updateVideoPlaylist(getUpdate(params, playlistUUID))
diff --git a/server/tests/api/check-params/videos.ts b/server/tests/api/check-params/videos.ts
index 5faba82c4..188d1835c 100644
--- a/server/tests/api/check-params/videos.ts
+++ b/server/tests/api/check-params/videos.ts
@@ -373,7 +373,7 @@ describe('Test videos API validator', function () {
373 it('Should fail with an incorrect thumbnail file', async function () { 373 it('Should fail with an incorrect thumbnail file', async function () {
374 const fields = baseCorrectParams 374 const fields = baseCorrectParams
375 const attaches = { 375 const attaches = {
376 thumbnailfile: join(root(), 'server', 'tests', 'fixtures', 'avatar.png'), 376 thumbnailfile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4'),
377 videofile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4') 377 videofile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4')
378 } 378 }
379 379
@@ -383,7 +383,7 @@ describe('Test videos API validator', function () {
383 it('Should fail with a big thumbnail file', async function () { 383 it('Should fail with a big thumbnail file', async function () {
384 const fields = baseCorrectParams 384 const fields = baseCorrectParams
385 const attaches = { 385 const attaches = {
386 thumbnailfile: join(root(), 'server', 'tests', 'fixtures', 'avatar-big.png'), 386 thumbnailfile: join(root(), 'server', 'tests', 'fixtures', 'preview-big.png'),
387 videofile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4') 387 videofile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4')
388 } 388 }
389 389
@@ -393,7 +393,7 @@ describe('Test videos API validator', function () {
393 it('Should fail with an incorrect preview file', async function () { 393 it('Should fail with an incorrect preview file', async function () {
394 const fields = baseCorrectParams 394 const fields = baseCorrectParams
395 const attaches = { 395 const attaches = {
396 previewfile: join(root(), 'server', 'tests', 'fixtures', 'avatar.png'), 396 previewfile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4'),
397 videofile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4') 397 videofile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4')
398 } 398 }
399 399
@@ -403,7 +403,7 @@ describe('Test videos API validator', function () {
403 it('Should fail with a big preview file', async function () { 403 it('Should fail with a big preview file', async function () {
404 const fields = baseCorrectParams 404 const fields = baseCorrectParams
405 const attaches = { 405 const attaches = {
406 previewfile: join(root(), 'server', 'tests', 'fixtures', 'avatar-big.png'), 406 previewfile: join(root(), 'server', 'tests', 'fixtures', 'preview-big.png'),
407 videofile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4') 407 videofile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4')
408 } 408 }
409 409
@@ -581,7 +581,7 @@ describe('Test videos API validator', function () {
581 it('Should fail with an incorrect thumbnail file', async function () { 581 it('Should fail with an incorrect thumbnail file', async function () {
582 const fields = baseCorrectParams 582 const fields = baseCorrectParams
583 const attaches = { 583 const attaches = {
584 thumbnailfile: join(root(), 'server', 'tests', 'fixtures', 'avatar.png') 584 thumbnailfile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4')
585 } 585 }
586 586
587 await makeUploadRequest({ 587 await makeUploadRequest({
@@ -597,7 +597,7 @@ describe('Test videos API validator', function () {
597 it('Should fail with a big thumbnail file', async function () { 597 it('Should fail with a big thumbnail file', async function () {
598 const fields = baseCorrectParams 598 const fields = baseCorrectParams
599 const attaches = { 599 const attaches = {
600 thumbnailfile: join(root(), 'server', 'tests', 'fixtures', 'avatar-big.png') 600 thumbnailfile: join(root(), 'server', 'tests', 'fixtures', 'preview-big.png')
601 } 601 }
602 602
603 await makeUploadRequest({ 603 await makeUploadRequest({
@@ -613,7 +613,7 @@ describe('Test videos API validator', function () {
613 it('Should fail with an incorrect preview file', async function () { 613 it('Should fail with an incorrect preview file', async function () {
614 const fields = baseCorrectParams 614 const fields = baseCorrectParams
615 const attaches = { 615 const attaches = {
616 previewfile: join(root(), 'server', 'tests', 'fixtures', 'avatar.png') 616 previewfile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4')
617 } 617 }
618 618
619 await makeUploadRequest({ 619 await makeUploadRequest({
@@ -629,7 +629,7 @@ describe('Test videos API validator', function () {
629 it('Should fail with a big preview file', async function () { 629 it('Should fail with a big preview file', async function () {
630 const fields = baseCorrectParams 630 const fields = baseCorrectParams
631 const attaches = { 631 const attaches = {
632 previewfile: join(root(), 'server', 'tests', 'fixtures', 'avatar-big.png') 632 previewfile: join(root(), 'server', 'tests', 'fixtures', 'preview-big.png')
633 } 633 }
634 634
635 await makeUploadRequest({ 635 await makeUploadRequest({
diff --git a/server/tests/fixtures/preview-big.png b/server/tests/fixtures/preview-big.png
new file mode 100644
index 000000000..612e297f1
--- /dev/null
+++ b/server/tests/fixtures/preview-big.png
Binary files differ