From e42d1e2dd2f5876035bbbec16496c10adeb0a2f2 Mon Sep 17 00:00:00 2001 From: morpheus65535 <5130500+morpheus65535@users.noreply.github.com> Date: Thu, 13 Sep 2018 00:32:09 -0400 Subject: [PATCH] Fix for #80 --- bazarr.py | 8 ++++---- views/settings.tpl | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/bazarr.py b/bazarr.py index fa3e2de7d..27072249e 100644 --- a/bazarr.py +++ b/bazarr.py @@ -1690,13 +1690,13 @@ def api_history(): c.close() return dict(subtitles=data) -@route(base_url + 'test_url/', method='GET') +@route(base_url + 'test_url//', method='GET') @custom_auth_basic(check_credentials) -def test_url(url): +def test_url(protocol, url): try: - result = requests.get(url).json()['version'] + result = requests.get(protocol + "://" + url).json()['version'] except: - return dict(status=False, version=result) + return dict(status=False) else: return dict(status=True, version=result) diff --git a/views/settings.tpl b/views/settings.tpl index 2cf51b433..00b4be5b2 100644 --- a/views/settings.tpl +++ b/views/settings.tpl @@ -1732,13 +1732,13 @@ $('#sonarr_validate').click(function() { if ($('#sonarr_ssl_div').checkbox('is checked')) { - sonarr_url = 'https://'; + protocol = 'https'; } else { - sonarr_url = 'http://'; + protocol = 'http'; } - sonarr_url += $('#settings_sonarr_ip').val() + ":" + $('#settings_sonarr_port').val() + "/" + $('#settings_sonarr_baseurl').val().replace(/^\/|\/$/g, '') + "/api/system/status?apikey=" + $('#settings_sonarr_apikey').val(); + sonarr_url = $('#settings_sonarr_ip').val() + ":" + $('#settings_sonarr_port').val() + "/" + $('#settings_sonarr_baseurl').val().replace(/^\/|\/$/g, '') + "/api/system/status?apikey=" + $('#settings_sonarr_apikey').val(); - $.getJSON("{{base_url}}test_url/" + encodeURIComponent(sonarr_url), function (data) { + $.getJSON("{{base_url}}test_url/" + protocol + "/" + encodeURIComponent(sonarr_url), function (data) { if (data.status) { $('#sonarr_validated').checkbox('check'); $('#sonarr_validation_result').text('Test successful: Sonarr v' + data.version).css('color', 'green'); @@ -1771,13 +1771,13 @@ $('#radarr_validate').click(function() { if ($('#radarr_ssl_div').checkbox('is checked')) { - radarr_url = 'https://'; + protocol = 'https'; } else { - radarr_url = 'http://'; + protocol = 'http'; } - radarr_url += $('#settings_radarr_ip').val() + ":" + $('#settings_radarr_port').val() + "/" + $('#settings_radarr_baseurl').val().replace(/^\/|\/$/g, '') + "/api/system/status?apikey=" + $('#settings_radarr_apikey').val(); + radarr_url = $('#settings_radarr_ip').val() + ":" + $('#settings_radarr_port').val() + "/" + $('#settings_radarr_baseurl').val().replace(/^\/|\/$/g, '') + "/api/system/status?apikey=" + $('#settings_radarr_apikey').val(); - $.getJSON("{{base_url}}test_url/" + encodeURIComponent(radarr_url), function (data) { + $.getJSON("{{base_url}}test_url/" + protocol + "/" + encodeURIComponent(radarr_url), function (data) { if (data.status) { $('#radarr_validated').checkbox('check'); $('#radarr_validation_result').text('Test successful: Radarr v' + data.version).css('color', 'green');