]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/controllers/api/videos.js
Server: add nsfw attribute
[github/Chocobozzz/PeerTube.git] / server / controllers / api / videos.js
index 8c69ff4e5b9dd31ded315e5b9d35c013d20c8abf..3d616e33ddb7ebc5fde16c07aa6a291130380796 100644 (file)
@@ -46,6 +46,7 @@ const storage = multer.diskStorage({
 const reqFiles = multer({ storage: storage }).fields([{ name: 'videofile', maxCount: 1 }])
 
 router.get('/categories', listVideoCategories)
+router.get('/licences', listVideoLicences)
 
 router.get('/abuse',
   oAuth.authenticate,
@@ -116,6 +117,10 @@ function listVideoCategories (req, res, next) {
   res.json(constants.VIDEO_CATEGORIES)
 }
 
+function listVideoLicences (req, res, next) {
+  res.json(constants.VIDEO_LICENCES)
+}
+
 function rateVideoRetryWrapper (req, res, next) {
   const options = {
     arguments: [ req, res ],
@@ -307,6 +312,8 @@ function addVideo (req, res, videoFile, finalCallback) {
         remoteId: null,
         extname: path.extname(videoFile.filename),
         category: videoInfos.category,
+        licence: videoInfos.licence,
+        nsfw: videoInfos.nsfw,
         description: videoInfos.description,
         duration: videoFile.duration,
         authorId: author.id
@@ -421,6 +428,8 @@ function updateVideo (req, res, finalCallback) {
 
       if (videoInfosToUpdate.name) videoInstance.set('name', videoInfosToUpdate.name)
       if (videoInfosToUpdate.category) videoInstance.set('category', videoInfosToUpdate.category)
+      if (videoInfosToUpdate.licence) videoInstance.set('licence', videoInfosToUpdate.licence)
+      if (videoInfosToUpdate.nsfw) videoInstance.set('nsfw', videoInfosToUpdate.nsfw)
       if (videoInfosToUpdate.description) videoInstance.set('description', videoInfosToUpdate.description)
 
       videoInstance.save(options).asCallback(function (err) {