diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-03-22 21:15:55 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-03-22 21:25:24 +0100 |
commit | 6e07c3de88791a0b342e0cc319590048117f9c2d (patch) | |
tree | 049f88d3f6d3ec0aeea09702a583deb86d6ef78f /server/controllers/api/videos.js | |
parent | 2d7653dc8726185615bab66353c4e3fb8fbb5a5f (diff) | |
download | PeerTube-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.js | 8 |
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 | ||
46 | const reqFiles = multer({ storage: storage }).fields([{ name: 'videofile', maxCount: 1 }]) | 46 | const reqFiles = multer({ storage: storage }).fields([{ name: 'videofile', maxCount: 1 }]) |
47 | 47 | ||
48 | router.get('/categories', listVideoCategories) | ||
49 | |||
48 | router.get('/abuse', | 50 | router.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 | ||
115 | function listVideoCategories (req, res, next) { | ||
116 | res.json(constants.VIDEO_CATEGORIES) | ||
117 | } | ||
118 | |||
113 | function rateVideoRetryWrapper (req, res, next) { | 119 | function 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) { |