mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-07 05:31:15 -07:00
Fix issue with server verification when working remotely.
This commit is contained in:
parent
637339ea62
commit
30c20b3061
4 changed files with 36 additions and 9 deletions
|
@ -859,7 +859,8 @@
|
||||||
$("#pms-verify-status").html('<i class="fa fa-refresh fa-spin"></i> Verifying server...');
|
$("#pms-verify-status").html('<i class="fa fa-refresh fa-spin"></i> Verifying server...');
|
||||||
$('#pms-verify-status').fadeIn('fast');
|
$('#pms-verify-status').fadeIn('fast');
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: 'http://' + pms_ip + ':' + pms_port + '/identity',
|
url: 'get_server_id',
|
||||||
|
data : { hostname: pms_ip, port: pms_port },
|
||||||
cache: true,
|
cache: true,
|
||||||
async: true,
|
async: true,
|
||||||
timeout: 5000,
|
timeout: 5000,
|
||||||
|
@ -868,7 +869,7 @@
|
||||||
$('#pms-verify-status').fadeIn('fast');
|
$('#pms-verify-status').fadeIn('fast');
|
||||||
},
|
},
|
||||||
success: function (xml) {
|
success: function (xml) {
|
||||||
if ( $(xml).find('MediaContainer').attr('machineIdentifier') ) {
|
if ($(xml).find('MediaContainer').attr('machineIdentifier')) {
|
||||||
$("#pms_identifier").val($(xml).find('MediaContainer').attr('machineIdentifier'));
|
$("#pms_identifier").val($(xml).find('MediaContainer').attr('machineIdentifier'));
|
||||||
$("#pms-verify-status").html('<i class="fa fa-check"></i> Server verified!');
|
$("#pms-verify-status").html('<i class="fa fa-check"></i> Server verified!');
|
||||||
$('#pms-verify-status').fadeIn('fast');
|
$('#pms-verify-status').fadeIn('fast');
|
||||||
|
|
|
@ -299,12 +299,12 @@ from plexpy import version
|
||||||
$("#pms-verify-status").html('<i class="fa fa-refresh fa-spin"></i> Validating server...');
|
$("#pms-verify-status").html('<i class="fa fa-refresh fa-spin"></i> Validating server...');
|
||||||
$('#pms-verify-status').fadeIn('fast');
|
$('#pms-verify-status').fadeIn('fast');
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: 'http://' + pms_ip + ':' + pms_port + '/identity',
|
url: 'get_server_id',
|
||||||
|
data : { hostname: pms_ip, port: pms_port },
|
||||||
cache: true,
|
cache: true,
|
||||||
async: true,
|
async: true,
|
||||||
timeout: 5000,
|
timeout: 5000,
|
||||||
error: function(jqXHR, textStatus, errorThrown) {
|
error: function(jqXHR, textStatus, errorThrown) {
|
||||||
console.log('we dont have a plex server');
|
|
||||||
$("#pms-verify-status").html('<i class="fa fa-exclamation-circle"></i> This is not a Plex Server!');
|
$("#pms-verify-status").html('<i class="fa fa-exclamation-circle"></i> This is not a Plex Server!');
|
||||||
$('#pms-verify-status').fadeIn('fast');
|
$('#pms-verify-status').fadeIn('fast');
|
||||||
},
|
},
|
||||||
|
|
|
@ -39,7 +39,8 @@ class HTTPHandler(object):
|
||||||
request_type='GET',
|
request_type='GET',
|
||||||
headers=None,
|
headers=None,
|
||||||
output_format='raw',
|
output_format='raw',
|
||||||
return_type=False):
|
return_type=False,
|
||||||
|
no_token=False):
|
||||||
|
|
||||||
valid_request_types = ['GET', 'POST', 'PUT', 'DELETE']
|
valid_request_types = ['GET', 'POST', 'PUT', 'DELETE']
|
||||||
|
|
||||||
|
@ -53,10 +54,12 @@ class HTTPHandler(object):
|
||||||
else:
|
else:
|
||||||
handler = HTTPConnection(self.host, self.port, timeout=10)
|
handler = HTTPConnection(self.host, self.port, timeout=10)
|
||||||
|
|
||||||
if uri.find('?') > 0:
|
token_string = ''
|
||||||
token_string = '&X-Plex-Token=' + self.token
|
if not no_token:
|
||||||
else:
|
if uri.find('?') > 0:
|
||||||
token_string = '?X-Plex-Token=' + self.token
|
token_string = '&X-Plex-Token=' + self.token
|
||||||
|
else:
|
||||||
|
token_string = '?X-Plex-Token=' + self.token
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if headers:
|
if headers:
|
||||||
|
|
|
@ -1000,3 +1000,26 @@ class WebInterface(object):
|
||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
def plexwatch_import(self, **kwargs):
|
def plexwatch_import(self, **kwargs):
|
||||||
return serve_template(templatename="plexwatch_import.html", title="Import PlexWatch Database")
|
return serve_template(templatename="plexwatch_import.html", title="Import PlexWatch Database")
|
||||||
|
|
||||||
|
@cherrypy.expose
|
||||||
|
def get_server_id(self, hostname=None, port=None, **kwargs):
|
||||||
|
from plexpy import http_handler
|
||||||
|
|
||||||
|
if hostname and port:
|
||||||
|
request_handler = http_handler.HTTPHandler(host=hostname,
|
||||||
|
port=port,
|
||||||
|
token=None)
|
||||||
|
uri = '/identity'
|
||||||
|
request = request_handler.make_request(uri=uri,
|
||||||
|
proto='http',
|
||||||
|
request_type='GET',
|
||||||
|
output_format='',
|
||||||
|
no_token=True)
|
||||||
|
if request:
|
||||||
|
cherrypy.response.headers['Content-type'] = 'application/xml'
|
||||||
|
return request
|
||||||
|
else:
|
||||||
|
logger.warn('Unable to retrieve data.')
|
||||||
|
return None
|
||||||
|
else:
|
||||||
|
return None
|
Loading…
Add table
Add a link
Reference in a new issue