mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-14 02:26:58 -07:00
Set different client ID when fetching a new Plex token
This commit is contained in:
parent
ef8557b50a
commit
e34e775f41
6 changed files with 16 additions and 14 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -973,7 +973,7 @@
|
|||
</div>
|
||||
<p class="help-block">Token for Plex.tv authentication.</p>
|
||||
</div>
|
||||
<input type="hidden" id="pms_uuid" name="pms_uuid" value="${config['pms_uuid']}">
|
||||
<input type="hidden" id="pms_client_id" name="pms_client_id" value="${config['pms_client_id']}">
|
||||
|
||||
<p><input type="button" class="btn btn-bright save-button" value="Save" data-success="Changes saved successfully"></p>
|
||||
|
||||
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
</p>
|
||||
</div>
|
||||
<input type="hidden" class="form-control" name="pms_token" id="pms_token" value="" data-validate="validatePMStoken">
|
||||
<input type="hidden" name="pms_token" id="pms_token" value="" data-validate="validatePMStoken">
|
||||
<input type="hidden" name="pms_client_id" id="pms_client_id" value="${config['pms_client_id']}">
|
||||
<a class="btn btn-dark" id="sign-in-plex" href="#" role="button">Sign In with Plex</a>
|
||||
<span style="margin-left: 10px; display: none;" id="pms-token-status"></span>
|
||||
</div>
|
||||
|
@ -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());
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue