From 437cf8b531652a4b101ec279dea7661e8dfb8cda Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Sun, 27 Nov 2016 11:09:05 +0100 Subject: [PATCH] Server: set manually the post host of a remote video throught the signature --- client/config/webpack.prod.js | 2 +- server/controllers/api/remote.js | 5 +++-- server/helpers/custom-validators/videos.js | 1 - server/models/video.js | 1 - 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/client/config/webpack.prod.js b/client/config/webpack.prod.js index ce6886af6..98507ff8e 100644 --- a/client/config/webpack.prod.js +++ b/client/config/webpack.prod.js @@ -227,7 +227,7 @@ module.exports = function (env) { [/\*/, /(?:)/], [/\[?\(?/, /(?:)/] ], - customAttrAssign: [/\)?\]?=/] + customAttrAssign: [/\)?]?=/] }, // FIXME: Remove 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) { const videoData = request.data if (request.type === 'add') { - addRemoteVideo(videoData, callbackEach) + addRemoteVideo(videoData, fromHost, callbackEach) } else if (request.type === 'remove') { removeRemoteVideo(videoData, fromHost, callbackEach) } else { @@ -52,10 +52,11 @@ function remoteVideos (req, res, next) { return res.type('json').status(204).end() } -function addRemoteVideo (videoToCreateData, callback) { +function addRemoteVideo (videoToCreateData, fromHost, callback) { logger.debug('Adding remote video "%s".', videoToCreateData.name) const video = new Video(videoToCreateData) + video.podHost = fromHost Video.generateThumbnailFromBase64(video, videoToCreateData.thumbnailBase64, function (err) { if (err) { 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) { isVideoDurationValid(video.duration) && isVideoMagnetValid(video.magnet) && isVideoNameValid(video.name) && - isVideoPodHostValid(video.podHost) && isVideoTagsValid(video.tags) && isVideoThumbnail64Valid(video.thumbnailBase64) && 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) { thumbnailBase64: new Buffer(thumbnailData).toString('base64'), tags: self.tags, createdDate: self.createdDate, - podHost: self.podHost, extname: self.extname }