aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers
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
parent28974889281523eec5b00dd5596c67d99c5167e5 (diff)
downloadPeerTube-6f0c39e2de400685b7baf8340b9e132f2659365a.tar.gz
PeerTube-6f0c39e2de400685b7baf8340b9e132f2659365a.tar.zst
PeerTube-6f0c39e2de400685b7baf8340b9e132f2659365a.zip
Server: add licence video attribute
Diffstat (limited to 'server/controllers')
-rw-r--r--server/controllers/api/remote/videos.js2
-rw-r--r--server/controllers/api/videos.js7
2 files changed, 9 insertions, 0 deletions
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) {
295 extname: videoToCreateData.extname, 295 extname: videoToCreateData.extname,
296 infoHash: videoToCreateData.infoHash, 296 infoHash: videoToCreateData.infoHash,
297 category: videoToCreateData.category, 297 category: videoToCreateData.category,
298 licence: videoToCreateData.licence,
298 description: videoToCreateData.description, 299 description: videoToCreateData.description,
299 authorId: author.id, 300 authorId: author.id,
300 duration: videoToCreateData.duration, 301 duration: videoToCreateData.duration,
@@ -392,6 +393,7 @@ function updateRemoteVideo (videoAttributesToUpdate, fromPod, finalCallback) {
392 393
393 videoInstance.set('name', videoAttributesToUpdate.name) 394 videoInstance.set('name', videoAttributesToUpdate.name)
394 videoInstance.set('category', videoAttributesToUpdate.category) 395 videoInstance.set('category', videoAttributesToUpdate.category)
396 videoInstance.set('licence', videoAttributesToUpdate.licence)
395 videoInstance.set('description', videoAttributesToUpdate.description) 397 videoInstance.set('description', videoAttributesToUpdate.description)
396 videoInstance.set('infoHash', videoAttributesToUpdate.infoHash) 398 videoInstance.set('infoHash', videoAttributesToUpdate.infoHash)
397 videoInstance.set('duration', videoAttributesToUpdate.duration) 399 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({
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) {