aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/videos.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-03-22 21:15:55 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-03-22 21:25:24 +0100
commit6e07c3de88791a0b342e0cc319590048117f9c2d (patch)
tree049f88d3f6d3ec0aeea09702a583deb86d6ef78f /server/controllers/api/videos.js
parent2d7653dc8726185615bab66353c4e3fb8fbb5a5f (diff)
downloadPeerTube-6e07c3de88791a0b342e0cc319590048117f9c2d.tar.gz
PeerTube-6e07c3de88791a0b342e0cc319590048117f9c2d.tar.zst
PeerTube-6e07c3de88791a0b342e0cc319590048117f9c2d.zip
Add video category support
Diffstat (limited to 'server/controllers/api/videos.js')
-rw-r--r--server/controllers/api/videos.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/server/controllers/api/videos.js b/server/controllers/api/videos.js
index 9acdb8fd2..8c69ff4e5 100644
--- a/server/controllers/api/videos.js
+++ b/server/controllers/api/videos.js
@@ -45,6 +45,8 @@ const storage = multer.diskStorage({
45 45
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)
49
48router.get('/abuse', 50router.get('/abuse',
49 oAuth.authenticate, 51 oAuth.authenticate,
50 admin.ensureIsAdmin, 52 admin.ensureIsAdmin,
@@ -110,6 +112,10 @@ module.exports = router
110 112
111// --------------------------------------------------------------------------- 113// ---------------------------------------------------------------------------
112 114
115function listVideoCategories (req, res, next) {
116 res.json(constants.VIDEO_CATEGORIES)
117}
118
113function rateVideoRetryWrapper (req, res, next) { 119function rateVideoRetryWrapper (req, res, next) {
114 const options = { 120 const options = {
115 arguments: [ req, res ], 121 arguments: [ req, res ],
@@ -300,6 +306,7 @@ function addVideo (req, res, videoFile, finalCallback) {
300 name: videoInfos.name, 306 name: videoInfos.name,
301 remoteId: null, 307 remoteId: null,
302 extname: path.extname(videoFile.filename), 308 extname: path.extname(videoFile.filename),
309 category: videoInfos.category,
303 description: videoInfos.description, 310 description: videoInfos.description,
304 duration: videoFile.duration, 311 duration: videoFile.duration,
305 authorId: author.id 312 authorId: author.id
@@ -413,6 +420,7 @@ function updateVideo (req, res, finalCallback) {
413 } 420 }
414 421
415 if (videoInfosToUpdate.name) videoInstance.set('name', videoInfosToUpdate.name) 422 if (videoInfosToUpdate.name) videoInstance.set('name', videoInfosToUpdate.name)
423 if (videoInfosToUpdate.category) videoInstance.set('category', videoInfosToUpdate.category)
416 if (videoInfosToUpdate.description) videoInstance.set('description', videoInfosToUpdate.description) 424 if (videoInfosToUpdate.description) videoInstance.set('description', videoInfosToUpdate.description)
417 425
418 videoInstance.save(options).asCallback(function (err) { 426 videoInstance.save(options).asCallback(function (err) {