diff --git a/source/VideoPlayer.brs b/source/VideoPlayer.brs index 3fc035de..64223aa2 100644 --- a/source/VideoPlayer.brs +++ b/source/VideoPlayer.brs @@ -46,10 +46,8 @@ function VideoContent(video) as object ' todo - audioFormat is read only video.content.audioFormat = getAudioFormat(meta) + video.content.setCertificatesFile("common:/certs/ca-bundle.crt") - if server_is_https() then - video.content.setCertificatesFile("common:/certs/ca-bundle.crt") - end if return video end function diff --git a/source/api/baserequest.brs b/source/api/baserequest.brs index 828b40f8..007a6403 100644 --- a/source/api/baserequest.brs +++ b/source/api/baserequest.brs @@ -36,7 +36,7 @@ end function function buildURL(path as String, params={} as Object) as string - full_url = get_url() + path + full_url = get_url() + "/" + path if params.count() > 0 full_url = full_url + "?" + buildParams(params) end if @@ -46,15 +46,10 @@ end function function APIRequest(url as String, params={} as Object) req = createObject("roUrlTransfer") - - if server_is_https() then - req.setCertificatesFile("common:/certs/ca-bundle.crt") - end if + req.setCertificatesFile("common:/certs/ca-bundle.crt") full_url = buildURL(url, params) - req.setUrl(full_url) - req = authorize_request(req) return req @@ -100,16 +95,15 @@ end function function get_url() base = get_setting("server") - - if base.right(1) <> "/" - base = base + "/" + if base.right(1) = "/" + base = base.left(base.len() - 1) end if + ' append http:// to the start if not specified + if base.left(5) <> "https" or <> "http:" + base = "http://" + base return base -end function -function server_is_https() as Boolean - return True end function function authorize_request(request)