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/pods.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/pods.js')
-rw-r--r-- | server/controllers/api/pods.js | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/server/controllers/api/pods.js b/server/controllers/api/pods.js index 853e0705b..7857fcee0 100644 --- a/server/controllers/api/pods.js +++ b/server/controllers/api/pods.js | |||
@@ -20,14 +20,14 @@ const Pod = mongoose.model('Pod') | |||
20 | router.get('/', listPods) | 20 | router.get('/', listPods) |
21 | router.post('/', | 21 | router.post('/', |
22 | validators.podsAdd, | 22 | validators.podsAdd, |
23 | podsMiddleware.setBodyUrlPort, | 23 | podsMiddleware.setBodyHostPort, |
24 | addPods | 24 | addPods |
25 | ) | 25 | ) |
26 | router.post('/makefriends', | 26 | router.post('/makefriends', |
27 | oAuth.authenticate, | 27 | oAuth.authenticate, |
28 | admin.ensureIsAdmin, | 28 | admin.ensureIsAdmin, |
29 | validators.makeFriends, | 29 | validators.makeFriends, |
30 | podsMiddleware.setBodyUrlsPort, | 30 | podsMiddleware.setBodyHostsPort, |
31 | makeFriends | 31 | makeFriends |
32 | ) | 32 | ) |
33 | router.get('/quitfriends', | 33 | router.get('/quitfriends', |
@@ -84,17 +84,17 @@ function addPods (req, res, next) { | |||
84 | } | 84 | } |
85 | 85 | ||
86 | function listPods (req, res, next) { | 86 | function listPods (req, res, next) { |
87 | Pod.list(function (err, podsUrlList) { | 87 | Pod.list(function (err, podsList) { |
88 | if (err) return next(err) | 88 | if (err) return next(err) |
89 | 89 | ||
90 | res.json(getFormatedPods(podsUrlList)) | 90 | res.json(getFormatedPods(podsList)) |
91 | }) | 91 | }) |
92 | } | 92 | } |
93 | 93 | ||
94 | function makeFriends (req, res, next) { | 94 | function makeFriends (req, res, next) { |
95 | const urls = req.body.urls | 95 | const hosts = req.body.hosts |
96 | 96 | ||
97 | friends.makeFriends(urls, function (err) { | 97 | friends.makeFriends(hosts, function (err) { |
98 | if (err) { | 98 | if (err) { |
99 | logger.error('Could not make friends.', { error: err }) | 99 | logger.error('Could not make friends.', { error: err }) |
100 | return | 100 | return |
@@ -107,11 +107,11 @@ function makeFriends (req, res, next) { | |||
107 | } | 107 | } |
108 | 108 | ||
109 | function removePods (req, res, next) { | 109 | function removePods (req, res, next) { |
110 | const url = req.body.signature.url | 110 | const host = req.body.signature.host |
111 | 111 | ||
112 | waterfall([ | 112 | waterfall([ |
113 | function loadPod (callback) { | 113 | function loadPod (callback) { |
114 | Pod.loadByUrl(url, callback) | 114 | Pod.loadByHost(host, callback) |
115 | }, | 115 | }, |
116 | 116 | ||
117 | function removePod (pod, callback) { | 117 | function removePod (pod, callback) { |