diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-11-14 20:03:04 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-11-16 20:29:26 +0100 |
commit | 49abbbbedca83b9031d3e2eb3ae9ad9b6a7d96ed (patch) | |
tree | 68c59d67637a297d513e07ea96ba236a7f0cd43b /server/controllers/api/remote.js | |
parent | 41b5da1d8cb41f5c49f0e0a01a54106c9a5925dd (diff) | |
download | PeerTube-49abbbbedca83b9031d3e2eb3ae9ad9b6a7d96ed.tar.gz PeerTube-49abbbbedca83b9031d3e2eb3ae9ad9b6a7d96ed.tar.zst PeerTube-49abbbbedca83b9031d3e2eb3ae9ad9b6a7d96ed.zip |
Pod URL -> pod host. HTTPS is required to make friends.
Reason: in a network with mix http/https pods, https pods won't be able
to play videos from http pod (insecure requests).
Diffstat (limited to 'server/controllers/api/remote.js')
-rw-r--r-- | server/controllers/api/remote.js | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/server/controllers/api/remote.js b/server/controllers/api/remote.js index 94808693d..4085deb2d 100644 --- a/server/controllers/api/remote.js +++ b/server/controllers/api/remote.js | |||
@@ -30,7 +30,7 @@ module.exports = router | |||
30 | 30 | ||
31 | function remoteVideos (req, res, next) { | 31 | function remoteVideos (req, res, next) { |
32 | const requests = req.body.data | 32 | const requests = req.body.data |
33 | const fromUrl = req.body.signature.url | 33 | const fromHost = req.body.signature.host |
34 | 34 | ||
35 | // We need to process in the same order to keep consistency | 35 | // We need to process in the same order to keep consistency |
36 | // TODO: optimization | 36 | // TODO: optimization |
@@ -40,7 +40,7 @@ function remoteVideos (req, res, next) { | |||
40 | if (request.type === 'add') { | 40 | if (request.type === 'add') { |
41 | addRemoteVideo(videoData, callbackEach) | 41 | addRemoteVideo(videoData, callbackEach) |
42 | } else if (request.type === 'remove') { | 42 | } else if (request.type === 'remove') { |
43 | removeRemoteVideo(videoData, fromUrl, callbackEach) | 43 | removeRemoteVideo(videoData, fromHost, callbackEach) |
44 | } else { | 44 | } else { |
45 | logger.error('Unkown remote request type %s.', request.type) | 45 | logger.error('Unkown remote request type %s.', request.type) |
46 | } | 46 | } |
@@ -62,16 +62,16 @@ function addRemoteVideo (videoToCreateData, callback) { | |||
62 | video.save(callback) | 62 | video.save(callback) |
63 | } | 63 | } |
64 | 64 | ||
65 | function removeRemoteVideo (videoToRemoveData, fromUrl, callback) { | 65 | function removeRemoteVideo (videoToRemoveData, fromHost, callback) { |
66 | // We need the list because we have to remove some other stuffs (thumbnail etc) | 66 | // We need the list because we have to remove some other stuffs (thumbnail etc) |
67 | Video.listByUrlAndRemoteId(fromUrl, videoToRemoveData.remoteId, function (err, videosList) { | 67 | Video.listByHostAndRemoteId(fromHost, videoToRemoveData.remoteId, function (err, videosList) { |
68 | if (err) { | 68 | if (err) { |
69 | logger.error('Cannot list videos from url and magnets.', { error: err }) | 69 | logger.error('Cannot list videos from host and magnets.', { error: err }) |
70 | return callback(err) | 70 | return callback(err) |
71 | } | 71 | } |
72 | 72 | ||
73 | if (videosList.length === 0) { | 73 | if (videosList.length === 0) { |
74 | logger.error('No remote video was found for this pod.', { magnetUri: videoToRemoveData.magnetUri, podUrl: fromUrl }) | 74 | logger.error('No remote video was found for this pod.', { magnetUri: videoToRemoveData.magnetUri, podHost: fromHost }) |
75 | } | 75 | } |
76 | 76 | ||
77 | each(videosList, function (video, callbackEach) { | 77 | each(videosList, function (video, callbackEach) { |