aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers
diff options
context:
space:
mode:
Diffstat (limited to 'server/initializers')
-rw-r--r--server/initializers/constants.js23
1 files changed, 14 insertions, 9 deletions
diff --git a/server/initializers/constants.js b/server/initializers/constants.js
index 63ac863c1..97d22abdb 100644
--- a/server/initializers/constants.js
+++ b/server/initializers/constants.js
@@ -9,11 +9,6 @@ let FRIEND_BASE_SCORE = 100
9// Time to wait between requests to the friends (10 min) 9// Time to wait between requests to the friends (10 min)
10let INTERVAL = 600000 10let INTERVAL = 600000
11 11
12// Max length of the author username
13const MAXIMUM_AUTHOR_LENGTH = 20
14// 2 hours maximum for the duration of a video (in seconds)
15let MAXIMUM_VIDEO_DURATION = 7200
16
17// Number of results by default for the pagination 12// Number of results by default for the pagination
18const PAGINATION_COUNT_DEFAULT = 15 13const PAGINATION_COUNT_DEFAULT = 15
19 14
@@ -42,11 +37,22 @@ const THUMBNAILS_SIZE = '200x110'
42// Path for access to thumbnails with express router 37// Path for access to thumbnails with express router
43const THUMBNAILS_STATIC_PATH = '/static/thumbnails' 38const THUMBNAILS_STATIC_PATH = '/static/thumbnails'
44 39
40const VIDEOS_CONSTRAINTS_FIELDS = {
41 NAME: { min: 1, max: 50 }, // Length
42 DESCRIPTION: { min: 1, max: 250 }, // Length
43 MAGNET_URI: { min: 10 }, // Length
44 DURATION: { min: 1, max: 7200 }, // Number
45 AUTHOR: { min: 3, max: 20 }, // Length
46 TAGS: { min: 1, max: 3 }, // Number of total tags
47 TAG: { min: 2, max: 10 }, // Length
48 THUMBNAIL: { min: 0, max: 20000 } // Bytes
49}
50
45// Special constants for a test instance 51// Special constants for a test instance
46if (isTestInstance() === true) { 52if (isTestInstance() === true) {
47 FRIEND_BASE_SCORE = 20 53 FRIEND_BASE_SCORE = 20
48 INTERVAL = 10000 54 INTERVAL = 10000
49 MAXIMUM_VIDEO_DURATION = 14 55 VIDEOS_CONSTRAINTS_FIELDS.DURATION.max = 14
50 REQUEST_RETRIES = 2 56 REQUEST_RETRIES = 2
51} 57}
52 58
@@ -56,15 +62,14 @@ module.exports = {
56 API_VERSION: API_VERSION, 62 API_VERSION: API_VERSION,
57 FRIEND_BASE_SCORE: FRIEND_BASE_SCORE, 63 FRIEND_BASE_SCORE: FRIEND_BASE_SCORE,
58 INTERVAL: INTERVAL, 64 INTERVAL: INTERVAL,
59 MAXIMUM_AUTHOR_LENGTH: MAXIMUM_AUTHOR_LENGTH,
60 MAXIMUM_VIDEO_DURATION: MAXIMUM_VIDEO_DURATION,
61 PAGINATION_COUNT_DEFAULT: PAGINATION_COUNT_DEFAULT, 65 PAGINATION_COUNT_DEFAULT: PAGINATION_COUNT_DEFAULT,
62 PODS_SCORE: PODS_SCORE, 66 PODS_SCORE: PODS_SCORE,
63 REQUEST_RETRIES: REQUEST_RETRIES, 67 REQUEST_RETRIES: REQUEST_RETRIES,
64 SEARCHABLE_COLUMNS: SEARCHABLE_COLUMNS, 68 SEARCHABLE_COLUMNS: SEARCHABLE_COLUMNS,
65 SORTABLE_COLUMNS: SORTABLE_COLUMNS, 69 SORTABLE_COLUMNS: SORTABLE_COLUMNS,
66 THUMBNAILS_SIZE: THUMBNAILS_SIZE, 70 THUMBNAILS_SIZE: THUMBNAILS_SIZE,
67 THUMBNAILS_STATIC_PATH: THUMBNAILS_STATIC_PATH 71 THUMBNAILS_STATIC_PATH: THUMBNAILS_STATIC_PATH,
72 VIDEOS_CONSTRAINTS_FIELDS: VIDEOS_CONSTRAINTS_FIELDS
68} 73}
69 74
70// --------------------------------------------------------------------------- 75// ---------------------------------------------------------------------------