mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-10 15:32:38 -07:00
Fix some issues with possible mismatching serverIDs causing bad ssl connections.
This commit is contained in:
parent
db543b8912
commit
a4dfc57cbe
5 changed files with 38 additions and 34 deletions
|
@ -355,9 +355,9 @@ available_notification_agents = sorted(notifiers.available_notification_agents()
|
||||||
</div>
|
</div>
|
||||||
<div class="checkbox">
|
<div class="checkbox">
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" id="pms_ssl" name="pms_ssl" value="1" ${config['pms_ssl']}> Force SSL
|
<input type="checkbox" id="pms_ssl" name="pms_ssl" value="1" ${config['pms_ssl']}> Use SSL
|
||||||
</label>
|
</label>
|
||||||
<p class="help-block">Force PlexPy to connect to your Plex Server via SSL. Your server needs to have remote access enabled.</p>
|
<p class="help-block">If you have secure connections enabled on your Plex Server, communicate with it securely.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<input type="hidden" id="pms_identifier" name="pms_identifier" value="${config['pms_identifier']}">
|
<input type="hidden" id="pms_identifier" name="pms_identifier" value="${config['pms_identifier']}">
|
||||||
|
|
|
@ -83,7 +83,7 @@ from plexpy import common
|
||||||
<div class="col-xs-4">
|
<div class="col-xs-4">
|
||||||
<div class="checkbox">
|
<div class="checkbox">
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" id="pms_ssl" name="pms_ssl" value="1"> Force SSL
|
<input type="checkbox" id="pms_ssl" name="pms_ssl" value="1"> Use SSL
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -244,7 +244,7 @@ from plexpy import common
|
||||||
},
|
},
|
||||||
render: {
|
render: {
|
||||||
option: function (item, escape) {
|
option: function (item, escape) {
|
||||||
return '<div data-use_ssl="' + item.httpsRequired + '" data-local="' + item.local + '" data-ci="' + item.clientIdentifier + '" data-ip="' + item.ip + '" data-port="' + item.port + '">' + item.value + '</div>';
|
return '<div data-use_ssl="' + item.httpsRequired + '" data-local="' + item.local + '" data-ci="' + item.clientIdentifier + '" data-ip="' + item.ip + '" data-port="' + item.port + '" data-label="' + item.label + '">' + item.value + ' (' + item.label + ')</div>';
|
||||||
},
|
},
|
||||||
item: function (item, escape) {
|
item: function (item, escape) {
|
||||||
// first item is rendered before initialization bug?
|
// first item is rendered before initialization bug?
|
||||||
|
@ -254,7 +254,7 @@ from plexpy import common
|
||||||
.filter('[value="' + item.value + '"]').data());
|
.filter('[value="' + item.value + '"]').data());
|
||||||
|
|
||||||
}
|
}
|
||||||
return '<div data-use_ssl="' + item.httpsRequired + '" data-local="' + item.local + '" data-ci="' + item.clientIdentifier + '" data-ip="' + item.ip + '" data-port="' + item.port + '">' + item.value + '</div>';
|
return '<div data-use_ssl="' + item.httpsRequired + '" data-local="' + item.local + '" data-ci="' + item.clientIdentifier + '" data-ip="' + item.ip + '" data-port="' + item.port + '" data-label="' + item.label + '">' + item.value + ' (' + item.label + ')</div>';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onChange: function (item) {
|
onChange: function (item) {
|
||||||
|
@ -378,8 +378,8 @@ from plexpy import common
|
||||||
var pms_ip = $("#pms_ip").val().trim();
|
var pms_ip = $("#pms_ip").val().trim();
|
||||||
var pms_port = $("#pms_port").val().trim();
|
var pms_port = $("#pms_port").val().trim();
|
||||||
var pms_identifier = $("#pms_identifier").val();
|
var pms_identifier = $("#pms_identifier").val();
|
||||||
var pms_ssl = $("#pms_ssl").val();
|
var pms_ssl = $("#pms_ssl").is(':checked') ? 1 : 0;
|
||||||
var pms_is_remote = $("#pms_is_remote").val();
|
var pms_is_remote = $("#pms_is_remote").is(':checked') ? 1 : 0;
|
||||||
if ((pms_ip !== '') || (pms_port !== '')) {
|
if ((pms_ip !== '') || (pms_port !== '')) {
|
||||||
$("#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');
|
||||||
|
|
|
@ -25,7 +25,7 @@ _CONFIG_DEFINITIONS = {
|
||||||
'PMS_NAME': (unicode, 'PMS', ''),
|
'PMS_NAME': (unicode, 'PMS', ''),
|
||||||
'PMS_PORT': (int, 'PMS', 32400),
|
'PMS_PORT': (int, 'PMS', 32400),
|
||||||
'PMS_TOKEN': (str, 'PMS', ''),
|
'PMS_TOKEN': (str, 'PMS', ''),
|
||||||
'PMS_SSL': (int, 'General', 0),
|
'PMS_SSL': (int, 'PMS', 0),
|
||||||
'PMS_URL': (str, 'PMS', ''),
|
'PMS_URL': (str, 'PMS', ''),
|
||||||
'PMS_USE_BIF': (int, 'PMS', 0),
|
'PMS_USE_BIF': (int, 'PMS', 0),
|
||||||
'PMS_UUID': (str, 'PMS', ''),
|
'PMS_UUID': (str, 'PMS', ''),
|
||||||
|
|
|
@ -493,6 +493,16 @@ class PlexTV(object):
|
||||||
connections = d.getElementsByTagName('Connection')
|
connections = d.getElementsByTagName('Connection')
|
||||||
|
|
||||||
for c in connections:
|
for c in connections:
|
||||||
|
# If this is a remote server don't show any local IPs.
|
||||||
|
if helpers.get_xml_attr(d, 'publicAddressMatches') == '0' and \
|
||||||
|
helpers.get_xml_attr(c, 'local') == '1':
|
||||||
|
continue
|
||||||
|
|
||||||
|
# If this is a local server don't show any remote IPs.
|
||||||
|
if helpers.get_xml_attr(d, 'publicAddressMatches') == '1' and \
|
||||||
|
helpers.get_xml_attr(c, 'local') == '0':
|
||||||
|
continue
|
||||||
|
|
||||||
server = {'httpsRequired': helpers.get_xml_attr(d, 'httpsRequired'),
|
server = {'httpsRequired': helpers.get_xml_attr(d, 'httpsRequired'),
|
||||||
'clientIdentifier': helpers.get_xml_attr(d, 'clientIdentifier'),
|
'clientIdentifier': helpers.get_xml_attr(d, 'clientIdentifier'),
|
||||||
'label': helpers.get_xml_attr(d, 'name'),
|
'label': helpers.get_xml_attr(d, 'name'),
|
||||||
|
|
|
@ -1187,6 +1187,11 @@ class WebInterface(object):
|
||||||
(kwargs['monitor_remote_access'] != plexpy.CONFIG.MONITOR_REMOTE_ACCESS):
|
(kwargs['monitor_remote_access'] != plexpy.CONFIG.MONITOR_REMOTE_ACCESS):
|
||||||
reschedule = True
|
reschedule = True
|
||||||
|
|
||||||
|
# If we change the SSL setting for PMS, make sure we grab the new url.
|
||||||
|
if 'pms_ssl' in kwargs and \
|
||||||
|
(kwargs['pms_ssl'] != plexpy.CONFIG.PMS_SSL):
|
||||||
|
server_changed = True
|
||||||
|
|
||||||
# Remove config with 'hscard-' prefix and change home_stats_cards to list
|
# Remove config with 'hscard-' prefix and change home_stats_cards to list
|
||||||
if 'home_stats_cards' in kwargs:
|
if 'home_stats_cards' in kwargs:
|
||||||
for k in kwargs.keys():
|
for k in kwargs.keys():
|
||||||
|
@ -1397,33 +1402,22 @@ class WebInterface(object):
|
||||||
def get_server_id(self, hostname=None, port=None, identifier=None, ssl=0, remote=0, **kwargs):
|
def get_server_id(self, hostname=None, port=None, identifier=None, ssl=0, remote=0, **kwargs):
|
||||||
from plexpy import http_handler
|
from plexpy import http_handler
|
||||||
|
|
||||||
# Attempt to get the pms_identifier from plex.tv if the server is published
|
# Grab our serverId.
|
||||||
# Works for all PMS SSL settings
|
# This endpoint always works over plain HTTP even when secure connections on PMS is set to required.
|
||||||
if not identifier and hostname and port:
|
if not identifier and hostname and port:
|
||||||
plex_tv = plextv.PlexTV()
|
request_handler = http_handler.HTTPHandler(host=hostname,
|
||||||
servers = plex_tv.discover()
|
port=port,
|
||||||
|
token=None)
|
||||||
for server in servers:
|
uri = '/identity'
|
||||||
if server['ip'] == hostname and server['port'] == port:
|
request = request_handler.make_request(uri=uri,
|
||||||
identifier = server['clientIdentifier']
|
proto='http',
|
||||||
break
|
request_type='GET',
|
||||||
|
output_format='xml',
|
||||||
# Fallback to checking /identity endpoint is server is unpublished
|
no_token=True,
|
||||||
# Cannot set SSL settings on the PMS if unpublished so 'http' is okay
|
timeout=10)
|
||||||
if not identifier:
|
if request:
|
||||||
request_handler = http_handler.HTTPHandler(host=hostname,
|
xml_head = request.getElementsByTagName('MediaContainer')[0]
|
||||||
port=port,
|
identifier = xml_head.getAttribute('machineIdentifier')
|
||||||
token=None)
|
|
||||||
uri = '/identity'
|
|
||||||
request = request_handler.make_request(uri=uri,
|
|
||||||
proto='http',
|
|
||||||
request_type='GET',
|
|
||||||
output_format='xml',
|
|
||||||
no_token=True,
|
|
||||||
timeout=10)
|
|
||||||
if request:
|
|
||||||
xml_head = request.getElementsByTagName('MediaContainer')[0]
|
|
||||||
identifier = xml_head.getAttribute('machineIdentifier')
|
|
||||||
|
|
||||||
if identifier:
|
if identifier:
|
||||||
cherrypy.response.headers['Content-type'] = 'application/json'
|
cherrypy.response.headers['Content-type'] = 'application/json'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue