Force PlexPy to connect to your Plex Server via SSL. Your server needs to have remote access enabled.
+
If you have secure connections enabled on your Plex Server, communicate with it securely.
diff --git a/data/interfaces/default/welcome.html b/data/interfaces/default/welcome.html
index 5174ade1..8f2325a8 100644
--- a/data/interfaces/default/welcome.html
+++ b/data/interfaces/default/welcome.html
@@ -83,7 +83,7 @@ from plexpy import common
@@ -244,7 +244,7 @@ from plexpy import common
},
render: {
option: function (item, escape) {
- return '
' + item.value + '
';
+ return '
' + item.value + ' (' + item.label + ')
';
},
item: function (item, escape) {
// first item is rendered before initialization bug?
@@ -254,7 +254,7 @@ from plexpy import common
.filter('[value="' + item.value + '"]').data());
}
- return '
' + item.value + '
';
+ return '
' + item.value + ' (' + item.label + ')
';
}
},
onChange: function (item) {
@@ -378,8 +378,8 @@ from plexpy import common
var pms_ip = $("#pms_ip").val().trim();
var pms_port = $("#pms_port").val().trim();
var pms_identifier = $("#pms_identifier").val();
- var pms_ssl = $("#pms_ssl").val();
- var pms_is_remote = $("#pms_is_remote").val();
+ var pms_ssl = $("#pms_ssl").is(':checked') ? 1 : 0;
+ var pms_is_remote = $("#pms_is_remote").is(':checked') ? 1 : 0;
if ((pms_ip !== '') || (pms_port !== '')) {
$("#pms-verify-status").html(' Validating server...');
$('#pms-verify-status').fadeIn('fast');
diff --git a/plexpy/config.py b/plexpy/config.py
index 45eb1c79..984d57bc 100644
--- a/plexpy/config.py
+++ b/plexpy/config.py
@@ -25,7 +25,7 @@ _CONFIG_DEFINITIONS = {
'PMS_NAME': (unicode, 'PMS', ''),
'PMS_PORT': (int, 'PMS', 32400),
'PMS_TOKEN': (str, 'PMS', ''),
- 'PMS_SSL': (int, 'General', 0),
+ 'PMS_SSL': (int, 'PMS', 0),
'PMS_URL': (str, 'PMS', ''),
'PMS_USE_BIF': (int, 'PMS', 0),
'PMS_UUID': (str, 'PMS', ''),
diff --git a/plexpy/plextv.py b/plexpy/plextv.py
index b3774342..df93548e 100644
--- a/plexpy/plextv.py
+++ b/plexpy/plextv.py
@@ -493,6 +493,16 @@ class PlexTV(object):
connections = d.getElementsByTagName('Connection')
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'),
'clientIdentifier': helpers.get_xml_attr(d, 'clientIdentifier'),
'label': helpers.get_xml_attr(d, 'name'),
diff --git a/plexpy/webserve.py b/plexpy/webserve.py
index 831aaef0..a81bf203 100644
--- a/plexpy/webserve.py
+++ b/plexpy/webserve.py
@@ -1187,6 +1187,11 @@ class WebInterface(object):
(kwargs['monitor_remote_access'] != plexpy.CONFIG.MONITOR_REMOTE_ACCESS):
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
if 'home_stats_cards' in kwargs:
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):
from plexpy import http_handler
- # Attempt to get the pms_identifier from plex.tv if the server is published
- # Works for all PMS SSL settings
+ # Grab our serverId.
+ # This endpoint always works over plain HTTP even when secure connections on PMS is set to required.
if not identifier and hostname and port:
- plex_tv = plextv.PlexTV()
- servers = plex_tv.discover()
-
- for server in servers:
- if server['ip'] == hostname and server['port'] == port:
- identifier = server['clientIdentifier']
- break
-
- # Fallback to checking /identity endpoint is server is unpublished
- # Cannot set SSL settings on the PMS if unpublished so 'http' is okay
- if not identifier:
- 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='xml',
- no_token=True,
- timeout=10)
- if request:
- xml_head = request.getElementsByTagName('MediaContainer')[0]
- identifier = xml_head.getAttribute('machineIdentifier')
+ 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='xml',
+ no_token=True,
+ timeout=10)
+ if request:
+ xml_head = request.getElementsByTagName('MediaContainer')[0]
+ identifier = xml_head.getAttribute('machineIdentifier')
if identifier:
cherrypy.response.headers['Content-type'] = 'application/json'