diff --git a/data/interfaces/default/js/script.js b/data/interfaces/default/js/script.js index 1df0636f..5b27d798 100644 --- a/data/interfaces/default/js/script.js +++ b/data/interfaces/default/js/script.js @@ -610,12 +610,12 @@ function uuidv4() { }); } -function getPlexHeaders() { +function getPlexHeaders(clientID) { return { 'Accept': 'application/json', 'X-Plex-Product': 'Tautulli', 'X-Plex-Version': 'Plex OAuth', - 'X-Plex-Client-Identifier': getLocalStorage('Tautulli_ClientID', uuidv4(), false), + 'X-Plex-Client-Identifier': clientID ? clientID : getLocalStorage('Tautulli_ClientID', uuidv4(), false), 'X-Plex-Platform': p.name, 'X-Plex-Platform-Version': p.version, 'X-Plex-Model': 'Plex OAuth', @@ -674,8 +674,8 @@ function closePlexOAuthWindow() { } } -getPlexOAuthPin = function () { - var x_plex_headers = getPlexHeaders(); +getPlexOAuthPin = function (clientID) { + var x_plex_headers = getPlexHeaders(clientID); var deferred = $.Deferred(); $.ajax({ @@ -695,7 +695,7 @@ getPlexOAuthPin = function () { var polling = null; -function PlexOAuth(success, error, pre) { +function PlexOAuth(success, error, pre, clientID) { if (typeof pre === "function") { pre() } @@ -703,8 +703,8 @@ function PlexOAuth(success, error, pre) { plex_oauth_window = PopupCenter('', 'Plex-OAuth', 600, 700); $(plex_oauth_window.document.body).html(plex_oauth_loader); - getPlexOAuthPin().then(function (data) { - var x_plex_headers = getPlexHeaders(); + getPlexOAuthPin(clientID).then(function (data) { + var x_plex_headers = getPlexHeaders(clientID); const pin = data.pin; const code = data.code; diff --git a/data/interfaces/default/settings.html b/data/interfaces/default/settings.html index e261b740..2e780b9e 100644 --- a/data/interfaces/default/settings.html +++ b/data/interfaces/default/settings.html @@ -973,7 +973,7 @@

Token for Plex.tv authentication.

- +

@@ -2753,7 +2753,7 @@ $(document).ready(function() { } $('#sign-in-plex').click(function() { - PlexOAuth(OAuthSuccessCallback, OAuthErrorCallback, OAuthPreFunction); + PlexOAuth(OAuthSuccessCallback, OAuthErrorCallback, OAuthPreFunction, $('#pms_client_id').val(uuidv4()).val()); }); // Load database import modal diff --git a/data/interfaces/default/welcome.html b/data/interfaces/default/welcome.html index 453c46e5..d411b42e 100644 --- a/data/interfaces/default/welcome.html +++ b/data/interfaces/default/welcome.html @@ -111,7 +111,8 @@ Tautulli requires a Plex.tv account. Click the button below to sign in on Plex.tv. You may need to allow popups in your browser.

- + + Sign In with Plex @@ -570,7 +571,7 @@ $(document).ready(function() { } $('#sign-in-plex').click(function() { - PlexOAuth(OAuthSuccessCallback, OAuthErrorCallback, OAuthPreFunction); + PlexOAuth(OAuthSuccessCallback, OAuthErrorCallback, OAuthPreFunction, $('#pms_client_id').val(uuidv4()).val()); }); }); diff --git a/plexpy/config.py b/plexpy/config.py index a4f98106..4d0a032a 100644 --- a/plexpy/config.py +++ b/plexpy/config.py @@ -50,6 +50,7 @@ FILENAME = "config.ini" _CONFIG_DEFINITIONS = { 'ALLOW_GUEST_ACCESS': (int, 'General', 0), 'DATE_FORMAT': (str, 'General', 'YYYY-MM-DD'), + 'PMS_CLIENT_ID': (str, 'PMS', ''), 'PMS_IDENTIFIER': (str, 'PMS', ''), 'PMS_IP': (str, 'PMS', '127.0.0.1'), 'PMS_IS_CLOUD': (int, 'PMS', 0), diff --git a/plexpy/http_handler.py b/plexpy/http_handler.py index 6569de4b..6672e050 100644 --- a/plexpy/http_handler.py +++ b/plexpy/http_handler.py @@ -55,7 +55,7 @@ class HTTPHandler(object): self.headers = { 'X-Plex-Product': plexpy.common.PRODUCT, 'X-Plex-Version': plexpy.common.RELEASE, - 'X-Plex-Client-Identifier': plexpy.CONFIG.PMS_UUID, + 'X-Plex-Client-Identifier': plexpy.CONFIG.PMS_CLIENT_ID or plexpy.CONFIG.PMS_UUID, 'X-Plex-Platform': plexpy.common.PLATFORM, 'X-Plex-Platform-Version': plexpy.common.PLATFORM_RELEASE, 'X-Plex-Device': '{} {}'.format(plexpy.common.PLATFORM, diff --git a/plexpy/webserve.py b/plexpy/webserve.py index 3eb77ba8..9e581a9f 100644 --- a/plexpy/webserve.py +++ b/plexpy/webserve.py @@ -205,6 +205,7 @@ class WebInterface(object): @requireAuth(member_of("admin")) def welcome(self, **kwargs): config = { + "pms_client_id": plexpy.CONFIG.PMS_CLIENT_ID, "pms_identifier": plexpy.CONFIG.PMS_IDENTIFIER, "pms_ip": plexpy.CONFIG.PMS_IP, "pms_port": plexpy.CONFIG.PMS_PORT, @@ -212,7 +213,6 @@ class WebInterface(object): "pms_ssl": plexpy.CONFIG.PMS_SSL, "pms_is_cloud": plexpy.CONFIG.PMS_IS_CLOUD, "pms_token": plexpy.CONFIG.PMS_TOKEN, - "pms_uuid": plexpy.CONFIG.PMS_UUID, "pms_name": plexpy.CONFIG.PMS_NAME, "logging_ignore_interval": plexpy.CONFIG.LOGGING_IGNORE_INTERVAL } @@ -3168,6 +3168,7 @@ class WebInterface(object): "check_github_interval": plexpy.CONFIG.CHECK_GITHUB_INTERVAL, "interface_list": interface_list, "cache_sizemb": plexpy.CONFIG.CACHE_SIZEMB, + "pms_client_id": plexpy.CONFIG.PMS_CLIENT_ID, "pms_identifier": plexpy.CONFIG.PMS_IDENTIFIER, "pms_ip": plexpy.CONFIG.PMS_IP, "pms_logs_folder": plexpy.CONFIG.PMS_LOGS_FOLDER, @@ -3178,7 +3179,6 @@ class WebInterface(object): "pms_is_cloud": plexpy.CONFIG.PMS_IS_CLOUD, "pms_url": plexpy.CONFIG.PMS_URL, "pms_url_manual": checked(plexpy.CONFIG.PMS_URL_MANUAL), - "pms_uuid": plexpy.CONFIG.PMS_UUID, "pms_web_url": plexpy.CONFIG.PMS_WEB_URL, "pms_name": plexpy.CONFIG.PMS_NAME, "pms_update_check_interval": plexpy.CONFIG.PMS_UPDATE_CHECK_INTERVAL,