PeerTube_original/server/helpers/custom-validators/pods.js
Chocobozzz 49abbbbedc 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).
2016-11-16 20:29:26 +01:00

22 lines
551 B
JavaScript

'use strict'
const validator = require('express-validator').validator
const miscValidators = require('./misc')
const podsValidators = {
isEachUniqueHostValid
}
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)
})
}
// ---------------------------------------------------------------------------
module.exports = podsValidators