diff --git a/data/interfaces/default/settings.html b/data/interfaces/default/settings.html index 96ee2494..36b82fb4 100644 --- a/data/interfaces/default/settings.html +++ b/data/interfaces/default/settings.html @@ -658,7 +658,7 @@ available_notification_agents = sorted(notifiers.available_notification_agents()

- Enable this to attempt to log the IP address of the user (for PMS 0.9.12 and below, IP address is automatically logged for PMS 0.9.14 and above). + Enable this to attempt to log the IP address of the user.

@@ -1896,13 +1896,45 @@ $(document).ready(function() { }) $.ajax({ - url: 'get_server_pref', - data: { pref: 'logDebug' }, + url: 'get_server_identity', async: true, success: function(data) { - if (data !== 'true') { - $("#debugLogCheck").html("Debug logging must be enabled on your Plex Server. Click here for help."); + var version = data.version.split('.') + if (parseInt(version[0]) >= 0 && parseInt(version[1]) >= 9 && parseInt(version[2]) >= 14) { + $("#debugLogCheck").html("IP address is automatically logged for PMS version 0.9.14 and above."); $("#ip_logging_enable").attr("disabled", true); + $("#ip_logging_enable").attr("checked", true); + } else { + $.ajax({ + url: 'get_server_pref', + data: { pref: 'logDebug' }, + async: true, + success: function(data) { + if (data !== 'true') { + $("#debugLogCheck").html("Debug logging must be enabled on your Plex Server. Click here for help."); + $("#ip_logging_enable").attr("disabled", true); + $("#ip_logging_enable").attr("checked", false); + } + } + }); + + // Check to see if our logs folder is set before allowing IP logging to be enabled. + checkLogsPath(); + + $("#pms_logs_folder").change(function() { + checkLogsPath(); + }); + + function checkLogsPath() { + if ($("#pms_logs_folder").val() == '') { + $("#debugLogCheck").html("You must first define your Plex Server Logs folder path under the Plex Media Server tab."); + $("#ip_logging_enable").attr("disabled", true); + $("#ip_logging_enable").attr("checked", false); + } else { + $("#ip_logging_enable").attr("disabled", false); + $("#debugLogCheck").html(""); + } + } } } }); @@ -1913,27 +1945,11 @@ $(document).ready(function() { async: true, success: function(data) { if (data !== 'true') { - $("#remoteAccessCheck").html("Remote access must be enabled on your Plex Server. Click here for help.") + $("#remoteAccessCheck").html("Remote access must be enabled on your Plex Server. Click here for help."); $("#monitor_remote_access").attr("disabled", true); } } }); - // Check to see if our logs folder is set before allowing IP logging to be enabled. - checkLogsPath(); - - $("#pms_logs_folder").change(function() { - checkLogsPath(); - }); - - function checkLogsPath() { - if ($("#pms_logs_folder").val() == '') { - $("#debugLogCheck").html("You must first define your Plex Server Logs folder path under the Plex Media Server tab."); - $("#ip_logging_enable").attr("disabled", true); - } else { - $("#ip_logging_enable").attr("disabled", false); - $("#debugLogCheck").html(""); - } - } var accordion_session = new Accordion($('#accordion-session'), false); var accordion_timeline = new Accordion($('#accordion-timeline'), false); diff --git a/plexpy/webserve.py b/plexpy/webserve.py index bc5edb7a..bb4a78e7 100644 --- a/plexpy/webserve.py +++ b/plexpy/webserve.py @@ -1943,7 +1943,7 @@ class WebInterface(object): @cherrypy.expose @addtoapi() def get_servers_info(self, **kwargs): - """ Graps info about the server + """ Grabs list of info about the servers Returns: json: @@ -1956,8 +1956,6 @@ class WebInterface(object): } ] ``` - - """ pms_connect = pmsconnect.PmsConnect() @@ -1969,6 +1967,30 @@ class WebInterface(object): else: logger.warn(u"Unable to retrieve data for get_servers_info.") + @cherrypy.expose + @addtoapi() + def get_server_identity(self, **kwargs): + """ Grabs info about the local server + + Returns: + json: + ``` + [{"machine_identifier": "1234", + "version": "0.9.15.x.xxx-xxxxxxx" + } + ] + ``` + """ + + pms_connect = pmsconnect.PmsConnect() + result = pms_connect.get_server_identity() + + if result: + cherrypy.response.headers['Content-type'] = 'application/json' + return json.dumps(result) + else: + logger.warn(u"Unable to retrieve data for get_server_identity.") + @cherrypy.expose @addtoapi() def get_server_friendly_name(self, **kwargs):