From 6f0c39e2de400685b7baf8340b9e132f2659365a Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 27 Mar 2017 20:53:11 +0200 Subject: Server: add licence video attribute --- server/controllers/api/remote/videos.js | 2 ++ server/controllers/api/videos.js | 7 +++++++ 2 files changed, 9 insertions(+) (limited to 'server/controllers') diff --git a/server/controllers/api/remote/videos.js b/server/controllers/api/remote/videos.js index c8ef0c445..a3e1189c7 100644 --- a/server/controllers/api/remote/videos.js +++ b/server/controllers/api/remote/videos.js @@ -295,6 +295,7 @@ function addRemoteVideo (videoToCreateData, fromPod, finalCallback) { extname: videoToCreateData.extname, infoHash: videoToCreateData.infoHash, category: videoToCreateData.category, + licence: videoToCreateData.licence, description: videoToCreateData.description, authorId: author.id, duration: videoToCreateData.duration, @@ -392,6 +393,7 @@ function updateRemoteVideo (videoAttributesToUpdate, fromPod, finalCallback) { videoInstance.set('name', videoAttributesToUpdate.name) videoInstance.set('category', videoAttributesToUpdate.category) + videoInstance.set('licence', videoAttributesToUpdate.licence) videoInstance.set('description', videoAttributesToUpdate.description) videoInstance.set('infoHash', videoAttributesToUpdate.infoHash) videoInstance.set('duration', videoAttributesToUpdate.duration) 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({ 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,7 @@ function addVideo (req, res, videoFile, finalCallback) { remoteId: null, extname: path.extname(videoFile.filename), category: videoInfos.category, + licence: videoInfos.licence, description: videoInfos.description, duration: videoFile.duration, authorId: author.id @@ -421,6 +427,7 @@ 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.description) videoInstance.set('description', videoInfosToUpdate.description) videoInstance.save(options).asCallback(function (err) { -- cgit v1.2.3