1
0
Fork 0
mirror of https://github.com/morpheus65535/bazarr synced 2024-12-24 16:52:06 +00:00
This commit is contained in:
morpheus65535 2018-09-13 00:32:09 -04:00
parent da7c1aa5ad
commit e42d1e2dd2
2 changed files with 12 additions and 12 deletions

View file

@ -1690,13 +1690,13 @@ def api_history():
c.close()
return dict(subtitles=data)
@route(base_url + 'test_url/<url:path>', method='GET')
@route(base_url + 'test_url/<protocol>/<url:path>', 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)

View file

@ -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');