aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--client/src/app/shared/forms/form-validators/video.ts8
-rw-r--r--client/src/app/videos/+video-edit/video-add.component.html2
-rw-r--r--client/src/app/videos/+video-edit/video-update.component.html2
-rw-r--r--client/src/app/videos/+video-edit/video-update.component.ts1
-rw-r--r--server/initializers/constants.ts8
-rw-r--r--server/tests/api/check-params/video-channels.ts6
-rw-r--r--server/tests/api/check-params/videos.ts16
7 files changed, 27 insertions, 16 deletions
diff --git a/client/src/app/shared/forms/form-validators/video.ts b/client/src/app/shared/forms/form-validators/video.ts
index 213ab15db..286a11179 100644
--- a/client/src/app/shared/forms/form-validators/video.ts
+++ b/client/src/app/shared/forms/form-validators/video.ts
@@ -1,11 +1,11 @@
1import { Validators } from '@angular/forms' 1import { Validators } from '@angular/forms'
2 2
3export const VIDEO_NAME = { 3export const VIDEO_NAME = {
4 VALIDATORS: [ Validators.required, Validators.minLength(3), Validators.maxLength(50) ], 4 VALIDATORS: [ Validators.required, Validators.minLength(3), Validators.maxLength(120) ],
5 MESSAGES: { 5 MESSAGES: {
6 'required': 'Video name is required.', 6 'required': 'Video name is required.',
7 'minlength': 'Video name must be at least 3 characters long.', 7 'minlength': 'Video name must be at least 3 characters long.',
8 'maxlength': 'Video name cannot be more than 50 characters long.' 8 'maxlength': 'Video name cannot be more than 120 characters long.'
9 } 9 }
10} 10}
11 11
@@ -45,10 +45,10 @@ export const VIDEO_DESCRIPTION = {
45} 45}
46 46
47export const VIDEO_TAGS = { 47export const VIDEO_TAGS = {
48 VALIDATORS: [ Validators.minLength(2), Validators.maxLength(10) ], 48 VALIDATORS: [ Validators.minLength(2), Validators.maxLength(30) ],
49 MESSAGES: { 49 MESSAGES: {
50 'minlength': 'A tag should be more than 2 characters long.', 50 'minlength': 'A tag should be more than 2 characters long.',
51 'maxlength': 'A tag should be less than 10 characters long.' 51 'maxlength': 'A tag should be less than 30 characters long.'
52 } 52 }
53} 53}
54 54
diff --git a/client/src/app/videos/+video-edit/video-add.component.html b/client/src/app/videos/+video-edit/video-add.component.html
index 7946c0879..136c82a7c 100644
--- a/client/src/app/videos/+video-edit/video-add.component.html
+++ b/client/src/app/videos/+video-edit/video-add.component.html
@@ -77,7 +77,7 @@
77 <label class="label-tags">Tags</label> <span class="little-information">(press enter to add the tag)</span> 77 <label class="label-tags">Tags</label> <span class="little-information">(press enter to add the tag)</span>
78 <tag-input 78 <tag-input
79 [ngModel]="tags" [validators]="tagValidators" [errorMessages]="tagValidatorsMessages" 79 [ngModel]="tags" [validators]="tagValidators" [errorMessages]="tagValidatorsMessages"
80 formControlName="tags" maxItems="3" modelAsStrings="true" 80 formControlName="tags" maxItems="5" modelAsStrings="true"
81 ></tag-input> 81 ></tag-input>
82 </div> 82 </div>
83 83
diff --git a/client/src/app/videos/+video-edit/video-update.component.html b/client/src/app/videos/+video-edit/video-update.component.html
index 7f4faf21b..4ade5a671 100644
--- a/client/src/app/videos/+video-edit/video-update.component.html
+++ b/client/src/app/videos/+video-edit/video-update.component.html
@@ -65,7 +65,7 @@
65 <label for="tags" class="label-tags">Tags</label> <span class="little-information">(press enter to add the tag)</span> 65 <label for="tags" class="label-tags">Tags</label> <span class="little-information">(press enter to add the tag)</span>
66 <tag-input 66 <tag-input
67 [ngModel]="tags" [validators]="tagValidators" [errorMessages]="tagValidatorsMessages" 67 [ngModel]="tags" [validators]="tagValidators" [errorMessages]="tagValidatorsMessages"
68 formControlName="tags" maxItems="3" modelAsStrings="true" 68 formControlName="tags" maxItems="5" modelAsStrings="true"
69 ></tag-input> 69 ></tag-input>
70 </div> 70 </div>
71 71
diff --git a/client/src/app/videos/+video-edit/video-update.component.ts b/client/src/app/videos/+video-edit/video-update.component.ts
index 30390ac05..c4ae22896 100644
--- a/client/src/app/videos/+video-edit/video-update.component.ts
+++ b/client/src/app/videos/+video-edit/video-update.component.ts
@@ -131,3 +131,4 @@ export class VideoUpdateComponent extends FormReactive implements OnInit {
131 this.form.patchValue(this.video.toJSON()) 131 this.form.patchValue(this.video.toJSON())
132 } 132 }
133} 133}
134
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index 71012f3a3..1581a3195 100644
--- a/server/initializers/constants.ts
+++ b/server/initializers/constants.ts
@@ -118,17 +118,17 @@ const CONSTRAINTS_FIELDS = {
118 REASON: { min: 2, max: 300 } // Length 118 REASON: { min: 2, max: 300 } // Length
119 }, 119 },
120 VIDEO_CHANNELS: { 120 VIDEO_CHANNELS: {
121 NAME: { min: 3, max: 50 }, // Length 121 NAME: { min: 3, max: 120 }, // Length
122 DESCRIPTION: { min: 3, max: 250 } // Length 122 DESCRIPTION: { min: 3, max: 250 } // Length
123 }, 123 },
124 VIDEOS: { 124 VIDEOS: {
125 NAME: { min: 3, max: 50 }, // Length 125 NAME: { min: 3, max: 120 }, // Length
126 DESCRIPTION: { min: 3, max: 250 }, // Length 126 DESCRIPTION: { min: 3, max: 250 }, // Length
127 EXTNAME: [ '.mp4', '.ogv', '.webm' ], 127 EXTNAME: [ '.mp4', '.ogv', '.webm' ],
128 INFO_HASH: { min: 40, max: 40 }, // Length, info hash is 20 bytes length but we represent it in hexadecimal so 20 * 2 128 INFO_HASH: { min: 40, max: 40 }, // Length, info hash is 20 bytes length but we represent it in hexadecimal so 20 * 2
129 DURATION: { min: 1, max: 7200 }, // Number 129 DURATION: { min: 1, max: 7200 }, // Number
130 TAGS: { min: 0, max: 3 }, // Number of total tags 130 TAGS: { min: 0, max: 5 }, // Number of total tags
131 TAG: { min: 2, max: 10 }, // Length 131 TAG: { min: 2, max: 30 }, // Length
132 THUMBNAIL: { min: 2, max: 30 }, 132 THUMBNAIL: { min: 2, max: 30 },
133 THUMBNAIL_DATA: { min: 0, max: 20000 }, // Bytes 133 THUMBNAIL_DATA: { min: 0, max: 20000 }, // Bytes
134 VIEWS: { min: 0 }, 134 VIEWS: { min: 0 },
diff --git a/server/tests/api/check-params/video-channels.ts b/server/tests/api/check-params/video-channels.ts
index b46b90c14..08d1af52e 100644
--- a/server/tests/api/check-params/video-channels.ts
+++ b/server/tests/api/check-params/video-channels.ts
@@ -119,6 +119,9 @@ describe('Test videos API validator', function () {
119 it('Should fail with a long name', async function () { 119 it('Should fail with a long name', async function () {
120 const fields = { 120 const fields = {
121 name: 'hello tooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo' + 121 name: 'hello tooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo' +
122 'oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo' +
123 'oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo' +
124 'oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo' +
122 'oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo long', 125 'oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo long',
123 description: 'super description' 126 description: 'super description'
124 } 127 }
@@ -178,6 +181,9 @@ describe('Test videos API validator', function () {
178 it('Should fail with a long name', async function () { 181 it('Should fail with a long name', async function () {
179 const fields = { 182 const fields = {
180 name: 'hello tooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo' + 183 name: 'hello tooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo' +
184 'oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo' +
185 'oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo' +
186 'oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo' +
181 'oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo long', 187 'oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo long',
182 description: 'super description' 188 description: 'super description'
183 } 189 }
diff --git a/server/tests/api/check-params/videos.ts b/server/tests/api/check-params/videos.ts
index 167b45b61..765b9c16e 100644
--- a/server/tests/api/check-params/videos.ts
+++ b/server/tests/api/check-params/videos.ts
@@ -124,7 +124,9 @@ describe('Test videos API validator', function () {
124 124
125 it('Should fail with a long name', async function () { 125 it('Should fail with a long name', async function () {
126 const fields = { 126 const fields = {
127 name: 'My very very very very very very very very very very very very very very very very long name', 127 name: 'My very very very very very very very very very very very very very very very very very ' +
128 'very very very very very very very very very very very very very very very very long long' +
129 'very very very very very very very very very very very very very very very very long name',
128 category: 5, 130 category: 5,
129 licence: 1, 131 licence: 1,
130 language: 6, 132 language: 6,
@@ -358,7 +360,7 @@ describe('Test videos API validator', function () {
358 language: 6, 360 language: 6,
359 nsfw: false, 361 nsfw: false,
360 description: 'my super description', 362 description: 'my super description',
361 tags: [ 'tag1', 'tag2', 'tag3', 'tag4' ], 363 tags: [ 'tag1', 'tag2', 'tag3', 'tag4', 'tag5', 'tag6' ],
362 channelId 364 channelId
363 } 365 }
364 const attaches = { 366 const attaches = {
@@ -392,7 +394,7 @@ describe('Test videos API validator', function () {
392 language: 6, 394 language: 6,
393 nsfw: false, 395 nsfw: false,
394 description: 'my super description', 396 description: 'my super description',
395 tags: [ 'my_super_tag_too_long', 'tag1' ], 397 tags: [ 'my_super_tag_too_long_long_long_long_long_long', 'tag1' ],
396 channelId 398 channelId
397 } 399 }
398 const attaches = { 400 const attaches = {
@@ -543,7 +545,9 @@ describe('Test videos API validator', function () {
543 545
544 it('Should fail with a long name', async function () { 546 it('Should fail with a long name', async function () {
545 const fields = { 547 const fields = {
546 name: 'My very very very very very very very very very very very very very very very very long name', 548 name: 'My very very very very very very very very very very very very very very very very very ' +
549 'very very very very very very very very very very very very very very very very long long' +
550 'very very very very very very very very very very very very very very very very long name',
547 category: 5, 551 category: 5,
548 licence: 2, 552 licence: 2,
549 language: 6, 553 language: 6,
@@ -629,7 +633,7 @@ describe('Test videos API validator', function () {
629 language: 6, 633 language: 6,
630 nsfw: false, 634 nsfw: false,
631 description: 'my super description', 635 description: 'my super description',
632 tags: [ 'tag1', 'tag2', 'tag3', 'tag4' ] 636 tags: [ 'tag1', 'tag2', 'tag3', 'tag4', 'tag5', 'tag6' ]
633 } 637 }
634 await makePutBodyRequest({ url: server.url, path: path + videoId, token: server.accessToken, fields }) 638 await makePutBodyRequest({ url: server.url, path: path + videoId, token: server.accessToken, fields })
635 }) 639 })
@@ -655,7 +659,7 @@ describe('Test videos API validator', function () {
655 language: 6, 659 language: 6,
656 nsfw: false, 660 nsfw: false,
657 description: 'my super description', 661 description: 'my super description',
658 tags: [ 'my_super_tag_too_long', 'tag1' ] 662 tags: [ 'my_super_tag_too_long_long_long_long', 'tag1' ]
659 } 663 }
660 await makePutBodyRequest({ url: server.url, path: path + videoId, token: server.accessToken, fields }) 664 await makePutBodyRequest({ url: server.url, path: path + videoId, token: server.accessToken, fields })
661 }) 665 })