From 49abbbbedca83b9031d3e2eb3ae9ad9b6a7d96ed Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 14 Nov 2016 20:03:04 +0100 Subject: 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). --- server/helpers/custom-validators/pods.js | 12 ++++++------ server/helpers/custom-validators/videos.js | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'server/helpers/custom-validators') 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 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) }) } diff --git a/server/helpers/custom-validators/videos.js b/server/helpers/custom-validators/videos.js index 45acb7686..4a6a62326 100644 --- a/server/helpers/custom-validators/videos.js +++ b/server/helpers/custom-validators/videos.js @@ -15,7 +15,7 @@ const videosValidators = { isVideoDurationValid, isVideoMagnetValid, isVideoNameValid, - isVideoPodUrlValid, + isVideoPodHostValid, isVideoTagsValid, isVideoThumbnailValid, isVideoThumbnail64Valid @@ -33,7 +33,7 @@ function isEachRemoteVideosValid (requests) { isVideoDurationValid(video.duration) && isVideoMagnetValid(video.magnet) && isVideoNameValid(video.name) && - isVideoPodUrlValid(video.podUrl) && + isVideoPodHostValid(video.podHost) && isVideoTagsValid(video.tags) && isVideoThumbnail64Valid(video.thumbnailBase64) && isVideoRemoteIdValid(video.remoteId) @@ -70,7 +70,7 @@ function isVideoNameValid (value) { return validator.isLength(value, VIDEOS_CONSTRAINTS_FIELDS.NAME) } -function isVideoPodUrlValid (value) { +function isVideoPodHostValid (value) { // TODO: set options (TLD...) return validator.isURL(value) } -- cgit v1.2.3