diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/initializers/constants.ts | 8 | ||||
-rw-r--r-- | server/tests/api/check-params/video-channels.ts | 6 | ||||
-rw-r--r-- | server/tests/api/check-params/videos.ts | 16 |
3 files changed, 20 insertions, 10 deletions
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 | }) |