From: Chocobozzz Date: Mon, 16 May 2016 17:51:07 +0000 (+0200) Subject: Add check for the author username length X-Git-Tag: v0.0.1-alpha~920 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=a996fc4abef3a02a7299a92dbcbdd6425b160af7;p=oweals%2Fpeertube.git Add check for the author username length --- 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) { !isNaN(val.duration) && val.duration >= 0 && val.duration < constants.MAXIMUM_VIDEO_DURATION && + validator.isLength(val.author, 1, constants.MAXIMUM_AUTHOR_LENGTH) && validator.isDate(val.createdDate) }) } 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 // Time to wait between requests to the friends let INTERVAL = 60000 +// Max length of the author username +const MAXIMUM_AUTHOR_LENGTH = 20 // 2 hours maximum for the duration of a video (in seconds) let MAXIMUM_VIDEO_DURATION = 7200 @@ -44,6 +46,7 @@ module.exports = { API_VERSION: API_VERSION, FRIEND_BASE_SCORE: FRIEND_BASE_SCORE, INTERVAL: INTERVAL, + MAXIMUM_AUTHOR_LENGTH: MAXIMUM_AUTHOR_LENGTH, MAXIMUM_VIDEO_DURATION: MAXIMUM_VIDEO_DURATION, PAGINATION_COUNT_DEFAULT: PAGINATION_COUNT_DEFAULT, PODS_SCORE: PODS_SCORE,