aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-11-27 11:09:05 +0100
committerChocobozzz <florian.bigard@gmail.com>2016-11-27 11:09:05 +0100
commit437cf8b531652a4b101ec279dea7661e8dfb8cda (patch)
tree0d2a3a49515e2ef3772b6425f25f08289216162d /server
parente903c2f3b7a3e63e58d9ef5934bcfd8f186b021a (diff)
downloadPeerTube-437cf8b531652a4b101ec279dea7661e8dfb8cda.tar.gz
PeerTube-437cf8b531652a4b101ec279dea7661e8dfb8cda.tar.zst
PeerTube-437cf8b531652a4b101ec279dea7661e8dfb8cda.zip
Server: set manually the post host of a remote video throught the
signature
Diffstat (limited to 'server')
-rw-r--r--server/controllers/api/remote.js5
-rw-r--r--server/helpers/custom-validators/videos.js1
-rw-r--r--server/models/video.js1
3 files changed, 3 insertions, 4 deletions
diff --git a/server/controllers/api/remote.js b/server/controllers/api/remote.js
index 2d0db51c0..35f386ba6 100644
--- a/server/controllers/api/remote.js
+++ b/server/controllers/api/remote.js
@@ -38,7 +38,7 @@ function remoteVideos (req, res, next) {
38 const videoData = request.data 38 const videoData = request.data
39 39
40 if (request.type === 'add') { 40 if (request.type === 'add') {
41 addRemoteVideo(videoData, callbackEach) 41 addRemoteVideo(videoData, fromHost, callbackEach)
42 } else if (request.type === 'remove') { 42 } else if (request.type === 'remove') {
43 removeRemoteVideo(videoData, fromHost, callbackEach) 43 removeRemoteVideo(videoData, fromHost, callbackEach)
44 } else { 44 } else {
@@ -52,10 +52,11 @@ function remoteVideos (req, res, next) {
52 return res.type('json').status(204).end() 52 return res.type('json').status(204).end()
53} 53}
54 54
55function addRemoteVideo (videoToCreateData, callback) { 55function addRemoteVideo (videoToCreateData, fromHost, callback) {
56 logger.debug('Adding remote video "%s".', videoToCreateData.name) 56 logger.debug('Adding remote video "%s".', videoToCreateData.name)
57 57
58 const video = new Video(videoToCreateData) 58 const video = new Video(videoToCreateData)
59 video.podHost = fromHost
59 Video.generateThumbnailFromBase64(video, videoToCreateData.thumbnailBase64, function (err) { 60 Video.generateThumbnailFromBase64(video, videoToCreateData.thumbnailBase64, function (err) {
60 if (err) { 61 if (err) {
61 logger.error('Cannot generate thumbnail from base 64 data.', { error: err }) 62 logger.error('Cannot generate thumbnail from base 64 data.', { error: err })
diff --git a/server/helpers/custom-validators/videos.js b/server/helpers/custom-validators/videos.js
index 4a6a62326..1a7753265 100644
--- a/server/helpers/custom-validators/videos.js
+++ b/server/helpers/custom-validators/videos.js
@@ -33,7 +33,6 @@ function isEachRemoteVideosValid (requests) {
33 isVideoDurationValid(video.duration) && 33 isVideoDurationValid(video.duration) &&
34 isVideoMagnetValid(video.magnet) && 34 isVideoMagnetValid(video.magnet) &&
35 isVideoNameValid(video.name) && 35 isVideoNameValid(video.name) &&
36 isVideoPodHostValid(video.podHost) &&
37 isVideoTagsValid(video.tags) && 36 isVideoTagsValid(video.tags) &&
38 isVideoThumbnail64Valid(video.thumbnailBase64) && 37 isVideoThumbnail64Valid(video.thumbnailBase64) &&
39 isVideoRemoteIdValid(video.remoteId) 38 isVideoRemoteIdValid(video.remoteId)
diff --git a/server/models/video.js b/server/models/video.js
index 3d7c16f0d..330067cdf 100644
--- a/server/models/video.js
+++ b/server/models/video.js
@@ -243,7 +243,6 @@ function toRemoteJSON (callback) {
243 thumbnailBase64: new Buffer(thumbnailData).toString('base64'), 243 thumbnailBase64: new Buffer(thumbnailData).toString('base64'),
244 tags: self.tags, 244 tags: self.tags,
245 createdDate: self.createdDate, 245 createdDate: self.createdDate,
246 podHost: self.podHost,
247 extname: self.extname 246 extname: self.extname
248 } 247 }
249 248