aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/videos.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-03-27 20:53:11 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-03-27 20:53:11 +0200
commit6f0c39e2de400685b7baf8340b9e132f2659365a (patch)
treeb036c6ebf65ff4cb7f5649fc48a0b7201370bddd /server/controllers/api/videos.js
parent28974889281523eec5b00dd5596c67d99c5167e5 (diff)
downloadPeerTube-6f0c39e2de400685b7baf8340b9e132f2659365a.tar.gz
PeerTube-6f0c39e2de400685b7baf8340b9e132f2659365a.tar.zst
PeerTube-6f0c39e2de400685b7baf8340b9e132f2659365a.zip
Server: add licence video attribute
Diffstat (limited to 'server/controllers/api/videos.js')
-rw-r--r--server/controllers/api/videos.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/server/controllers/api/videos.js b/server/controllers/api/videos.js
index 8c69ff4e5..375e89387 100644
--- a/server/controllers/api/videos.js
+++ b/server/controllers/api/videos.js
@@ -46,6 +46,7 @@ const storage = multer.diskStorage({
46const reqFiles = multer({ storage: storage }).fields([{ name: 'videofile', maxCount: 1 }]) 46const reqFiles = multer({ storage: storage }).fields([{ name: 'videofile', maxCount: 1 }])
47 47
48router.get('/categories', listVideoCategories) 48router.get('/categories', listVideoCategories)
49router.get('/licences', listVideoLicences)
49 50
50router.get('/abuse', 51router.get('/abuse',
51 oAuth.authenticate, 52 oAuth.authenticate,
@@ -116,6 +117,10 @@ function listVideoCategories (req, res, next) {
116 res.json(constants.VIDEO_CATEGORIES) 117 res.json(constants.VIDEO_CATEGORIES)
117} 118}
118 119
120function listVideoLicences (req, res, next) {
121 res.json(constants.VIDEO_LICENCES)
122}
123
119function rateVideoRetryWrapper (req, res, next) { 124function rateVideoRetryWrapper (req, res, next) {
120 const options = { 125 const options = {
121 arguments: [ req, res ], 126 arguments: [ req, res ],
@@ -307,6 +312,7 @@ function addVideo (req, res, videoFile, finalCallback) {
307 remoteId: null, 312 remoteId: null,
308 extname: path.extname(videoFile.filename), 313 extname: path.extname(videoFile.filename),
309 category: videoInfos.category, 314 category: videoInfos.category,
315 licence: videoInfos.licence,
310 description: videoInfos.description, 316 description: videoInfos.description,
311 duration: videoFile.duration, 317 duration: videoFile.duration,
312 authorId: author.id 318 authorId: author.id
@@ -421,6 +427,7 @@ function updateVideo (req, res, finalCallback) {
421 427
422 if (videoInfosToUpdate.name) videoInstance.set('name', videoInfosToUpdate.name) 428 if (videoInfosToUpdate.name) videoInstance.set('name', videoInfosToUpdate.name)
423 if (videoInfosToUpdate.category) videoInstance.set('category', videoInfosToUpdate.category) 429 if (videoInfosToUpdate.category) videoInstance.set('category', videoInfosToUpdate.category)
430 if (videoInfosToUpdate.licence) videoInstance.set('licence', videoInfosToUpdate.licence)
424 if (videoInfosToUpdate.description) videoInstance.set('description', videoInfosToUpdate.description) 431 if (videoInfosToUpdate.description) videoInstance.set('description', videoInfosToUpdate.description)
425 432
426 videoInstance.save(options).asCallback(function (err) { 433 videoInstance.save(options).asCallback(function (err) {