aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-05-16 19:51:07 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-05-16 19:51:07 +0200
commita996fc4abef3a02a7299a92dbcbdd6425b160af7 (patch)
tree13476e40a580ec39d818d87b53feb1d2dfba1a27
parent67100f1f971dd10a466a321899b56c0813e08d31 (diff)
downloadPeerTube-a996fc4abef3a02a7299a92dbcbdd6425b160af7.tar.gz
PeerTube-a996fc4abef3a02a7299a92dbcbdd6425b160af7.tar.zst
PeerTube-a996fc4abef3a02a7299a92dbcbdd6425b160af7.zip
Add check for the author username length
-rw-r--r--server/helpers/customValidators.js1
-rw-r--r--server/initializers/constants.js3
2 files changed, 4 insertions, 0 deletions
diff --git a/server/helpers/customValidators.js b/server/helpers/customValidators.js
index 9b982369e..b95e2b9bb 100644
--- a/server/helpers/customValidators.js
+++ b/server/helpers/customValidators.js
@@ -19,6 +19,7 @@ function eachIsRemoteVideosAddValid (values) {
19 !isNaN(val.duration) && 19 !isNaN(val.duration) &&
20 val.duration >= 0 && 20 val.duration >= 0 &&
21 val.duration < constants.MAXIMUM_VIDEO_DURATION && 21 val.duration < constants.MAXIMUM_VIDEO_DURATION &&
22 validator.isLength(val.author, 1, constants.MAXIMUM_AUTHOR_LENGTH) &&
22 validator.isDate(val.createdDate) 23 validator.isDate(val.createdDate)
23 }) 24 })
24} 25}
diff --git a/server/initializers/constants.js b/server/initializers/constants.js
index d87a376d3..78bee5efe 100644
--- a/server/initializers/constants.js
+++ b/server/initializers/constants.js
@@ -9,6 +9,8 @@ let FRIEND_BASE_SCORE = 100
9// Time to wait between requests to the friends 9// Time to wait between requests to the friends
10let INTERVAL = 60000 10let INTERVAL = 60000
11 11
12// Max length of the author username
13const MAXIMUM_AUTHOR_LENGTH = 20
12// 2 hours maximum for the duration of a video (in seconds) 14// 2 hours maximum for the duration of a video (in seconds)
13let MAXIMUM_VIDEO_DURATION = 7200 15let MAXIMUM_VIDEO_DURATION = 7200
14 16
@@ -44,6 +46,7 @@ module.exports = {
44 API_VERSION: API_VERSION, 46 API_VERSION: API_VERSION,
45 FRIEND_BASE_SCORE: FRIEND_BASE_SCORE, 47 FRIEND_BASE_SCORE: FRIEND_BASE_SCORE,
46 INTERVAL: INTERVAL, 48 INTERVAL: INTERVAL,
49 MAXIMUM_AUTHOR_LENGTH: MAXIMUM_AUTHOR_LENGTH,
47 MAXIMUM_VIDEO_DURATION: MAXIMUM_VIDEO_DURATION, 50 MAXIMUM_VIDEO_DURATION: MAXIMUM_VIDEO_DURATION,
48 PAGINATION_COUNT_DEFAULT: PAGINATION_COUNT_DEFAULT, 51 PAGINATION_COUNT_DEFAULT: PAGINATION_COUNT_DEFAULT,
49 PODS_SCORE: PODS_SCORE, 52 PODS_SCORE: PODS_SCORE,