1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-04 02:09:37 +02:00

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).
This commit is contained in:
Chocobozzz 2016-11-14 20:03:04 +01:00
parent 41b5da1d8c
commit 49abbbbedc
24 changed files with 167 additions and 195 deletions

View file

@ -5,14 +5,14 @@ const validator = require('express-validator').validator
const miscValidators = require('./misc')
const podsValidators = {
isEachUniqueUrlValid
isEachUniqueHostValid
}
function isEachUniqueUrlValid (urls) {
return miscValidators.isArray(urls) &&
urls.length !== 0 &&
urls.every(function (url) {
return validator.isURL(url) && urls.indexOf(url) === urls.lastIndexOf(url)
function isEachUniqueHostValid (hosts) {
return miscValidators.isArray(hosts) &&
hosts.length !== 0 &&
hosts.every(function (host) {
return validator.isURL(host) && host.split('://').length === 1 && hosts.indexOf(host) === hosts.lastIndexOf(host)
})
}