diff options
Diffstat (limited to 'server/initializers')
-rw-r--r-- | server/initializers/constants.js | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/server/initializers/constants.js b/server/initializers/constants.js index 467816f2c..5f4aeccc6 100644 --- a/server/initializers/constants.js +++ b/server/initializers/constants.js | |||
@@ -3,6 +3,23 @@ | |||
3 | // API version of our pod | 3 | // API version of our pod |
4 | const API_VERSION = 'v1' | 4 | const API_VERSION = 'v1' |
5 | 5 | ||
6 | const CONSTRAINTS_FIELDS = { | ||
7 | USERS: { | ||
8 | USERNAME: { min: 3, max: 20 }, // Length | ||
9 | PASSWORD: { min: 6, max: 255 } // Length | ||
10 | }, | ||
11 | VIDEOS: { | ||
12 | NAME: { min: 3, max: 50 }, // Length | ||
13 | DESCRIPTION: { min: 3, max: 250 }, // Length | ||
14 | MAGNET_URI: { min: 10 }, // Length | ||
15 | DURATION: { min: 1, max: 7200 }, // Number | ||
16 | TAGS: { min: 1, max: 3 }, // Number of total tags | ||
17 | TAG: { min: 2, max: 10 }, // Length | ||
18 | THUMBNAIL: { min: 2, max: 30 }, | ||
19 | THUMBNAIL64: { min: 0, max: 20000 } // Bytes | ||
20 | } | ||
21 | } | ||
22 | |||
6 | // Score a pod has when we create it as a friend | 23 | // Score a pod has when we create it as a friend |
7 | const FRIEND_SCORE = { | 24 | const FRIEND_SCORE = { |
8 | BASE: 100, | 25 | BASE: 100, |
@@ -55,29 +72,18 @@ const THUMBNAILS_SIZE = '200x110' | |||
55 | // Path for access to thumbnails with express router | 72 | // Path for access to thumbnails with express router |
56 | const THUMBNAILS_STATIC_PATH = '/static/thumbnails' | 73 | const THUMBNAILS_STATIC_PATH = '/static/thumbnails' |
57 | 74 | ||
58 | const VIDEOS_CONSTRAINTS_FIELDS = { | ||
59 | NAME: { min: 3, max: 50 }, // Length | ||
60 | DESCRIPTION: { min: 3, max: 250 }, // Length | ||
61 | MAGNET_URI: { min: 10 }, // Length | ||
62 | DURATION: { min: 1, max: 7200 }, // Number | ||
63 | AUTHOR: { min: 3, max: 20 }, // Length | ||
64 | TAGS: { min: 1, max: 3 }, // Number of total tags | ||
65 | TAG: { min: 2, max: 10 }, // Length | ||
66 | THUMBNAIL: { min: 2, max: 30 }, | ||
67 | THUMBNAIL64: { min: 0, max: 20000 } // Bytes | ||
68 | } | ||
69 | |||
70 | // Special constants for a test instance | 75 | // Special constants for a test instance |
71 | if (isTestInstance() === true) { | 76 | if (isTestInstance() === true) { |
72 | FRIEND_SCORE.BASE = 20 | 77 | FRIEND_SCORE.BASE = 20 |
73 | INTERVAL = 10000 | 78 | INTERVAL = 10000 |
74 | VIDEOS_CONSTRAINTS_FIELDS.DURATION.max = 14 | 79 | CONSTRAINTS_FIELDS.VIDEOS.DURATION.max = 14 |
75 | } | 80 | } |
76 | 81 | ||
77 | // --------------------------------------------------------------------------- | 82 | // --------------------------------------------------------------------------- |
78 | 83 | ||
79 | module.exports = { | 84 | module.exports = { |
80 | API_VERSION: API_VERSION, | 85 | API_VERSION: API_VERSION, |
86 | CONSTRAINTS_FIELDS: CONSTRAINTS_FIELDS, | ||
81 | FRIEND_SCORE: FRIEND_SCORE, | 87 | FRIEND_SCORE: FRIEND_SCORE, |
82 | INTERVAL: INTERVAL, | 88 | INTERVAL: INTERVAL, |
83 | OAUTH_LIFETIME: OAUTH_LIFETIME, | 89 | OAUTH_LIFETIME: OAUTH_LIFETIME, |
@@ -90,8 +96,7 @@ module.exports = { | |||
90 | SEEDS_IN_PARALLEL: SEEDS_IN_PARALLEL, | 96 | SEEDS_IN_PARALLEL: SEEDS_IN_PARALLEL, |
91 | SORTABLE_COLUMNS: SORTABLE_COLUMNS, | 97 | SORTABLE_COLUMNS: SORTABLE_COLUMNS, |
92 | THUMBNAILS_SIZE: THUMBNAILS_SIZE, | 98 | THUMBNAILS_SIZE: THUMBNAILS_SIZE, |
93 | THUMBNAILS_STATIC_PATH: THUMBNAILS_STATIC_PATH, | 99 | THUMBNAILS_STATIC_PATH: THUMBNAILS_STATIC_PATH |
94 | VIDEOS_CONSTRAINTS_FIELDS: VIDEOS_CONSTRAINTS_FIELDS | ||
95 | } | 100 | } |
96 | 101 | ||
97 | // --------------------------------------------------------------------------- | 102 | // --------------------------------------------------------------------------- |