aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/custom-validators/pods.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-11-14 20:03:04 +0100
committerChocobozzz <florian.bigard@gmail.com>2016-11-16 20:29:26 +0100
commit49abbbbedca83b9031d3e2eb3ae9ad9b6a7d96ed (patch)
tree68c59d67637a297d513e07ea96ba236a7f0cd43b /server/helpers/custom-validators/pods.js
parent41b5da1d8cb41f5c49f0e0a01a54106c9a5925dd (diff)
downloadPeerTube-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/helpers/custom-validators/pods.js')
-rw-r--r--server/helpers/custom-validators/pods.js12
1 files changed, 6 insertions, 6 deletions
diff --git a/server/helpers/custom-validators/pods.js b/server/helpers/custom-validators/pods.js
index 40f8b5d0b..0154a2424 100644
--- a/server/helpers/custom-validators/pods.js
+++ b/server/helpers/custom-validators/pods.js
@@ -5,14 +5,14 @@ const validator = require('express-validator').validator
5const miscValidators = require('./misc') 5const miscValidators = require('./misc')
6 6
7const podsValidators = { 7const podsValidators = {
8 isEachUniqueUrlValid 8 isEachUniqueHostValid
9} 9}
10 10
11function isEachUniqueUrlValid (urls) { 11function isEachUniqueHostValid (hosts) {
12 return miscValidators.isArray(urls) && 12 return miscValidators.isArray(hosts) &&
13 urls.length !== 0 && 13 hosts.length !== 0 &&
14 urls.every(function (url) { 14 hosts.every(function (host) {
15 return validator.isURL(url) && urls.indexOf(url) === urls.lastIndexOf(url) 15 return validator.isURL(host) && host.split('://').length === 1 && hosts.indexOf(host) === hosts.lastIndexOf(host)
16 }) 16 })
17} 17}
18 18