pull/145/head
morpheus65535 6 years ago
parent da7c1aa5ad
commit e42d1e2dd2

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

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

Loading…
Cancel
Save