]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/helpers/custom-validators/videos.js
Server: add licence video attribute
[github/Chocobozzz/PeerTube.git] / server / helpers / custom-validators / videos.js
index 92b36671702b381179a8a0046b900cfad9ee6397..8495e9665965d3b9a759c6d2b09f1829a43e38ad 100644 (file)
@@ -14,6 +14,7 @@ const videosValidators = {
   isVideoAuthorValid,
   isVideoDateValid,
   isVideoCategoryValid,
+  isVideoLicenceValid,
   isVideoDescriptionValid,
   isVideoDurationValid,
   isVideoInfoHashValid,
@@ -45,6 +46,10 @@ function isVideoCategoryValid (value) {
   return constants.VIDEO_CATEGORIES[value] !== undefined
 }
 
+function isVideoLicenceValid (value) {
+  return constants.VIDEO_LICENCES[value] !== undefined
+}
+
 function isVideoDescriptionValid (value) {
   return validator.isLength(value, VIDEOS_CONSTRAINTS_FIELDS.DESCRIPTION)
 }
@@ -69,8 +74,7 @@ function isVideoTagsValid (tags) {
   return miscValidators.isArray(tags) &&
          validator.isInt(tags.length, VIDEOS_CONSTRAINTS_FIELDS.TAGS) &&
          tags.every(function (tag) {
-           return validator.isAlphanumeric(tag) &&
-                  validator.isLength(tag, VIDEOS_CONSTRAINTS_FIELDS.TAG)
+           return validator.isLength(tag, VIDEOS_CONSTRAINTS_FIELDS.TAG)
          })
 }