mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-06 21:21:15 -07:00
Add getPlexHeaders function
This commit is contained in:
parent
68df0f07c8
commit
766e33df0e
3 changed files with 16 additions and 10 deletions
|
@ -560,7 +560,8 @@ function uuidv4() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var x_plex_headers = {
|
function getPlexHeaders() {
|
||||||
|
return {
|
||||||
'Accept': 'application/json',
|
'Accept': 'application/json',
|
||||||
'X-Plex-Product': 'Tautulli',
|
'X-Plex-Product': 'Tautulli',
|
||||||
'X-Plex-Version': 'Plex OAuth',
|
'X-Plex-Version': 'Plex OAuth',
|
||||||
|
@ -569,7 +570,8 @@ var x_plex_headers = {
|
||||||
'X-Plex-Platform-Version': p.version,
|
'X-Plex-Platform-Version': p.version,
|
||||||
'X-Plex-Device': p.os,
|
'X-Plex-Device': p.os,
|
||||||
'X-Plex-Device-Name': p.name
|
'X-Plex-Device-Name': p.name
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
var plex_oauth_window = null;
|
var plex_oauth_window = null;
|
||||||
const plex_oauth_loader = '<style>' +
|
const plex_oauth_loader = '<style>' +
|
||||||
|
@ -620,6 +622,7 @@ function closePlexOAuthWindow() {
|
||||||
}
|
}
|
||||||
|
|
||||||
getPlexOAuthPin = function () {
|
getPlexOAuthPin = function () {
|
||||||
|
var x_plex_headers = getPlexHeaders();
|
||||||
var deferred = $.Deferred();
|
var deferred = $.Deferred();
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
@ -648,6 +651,7 @@ function PlexOAuth(success, error, pre) {
|
||||||
$(plex_oauth_window.document.body).html(plex_oauth_loader);
|
$(plex_oauth_window.document.body).html(plex_oauth_loader);
|
||||||
|
|
||||||
getPlexOAuthPin().then(function (data) {
|
getPlexOAuthPin().then(function (data) {
|
||||||
|
var x_plex_headers = getPlexHeaders();
|
||||||
const pin = data.pin;
|
const pin = data.pin;
|
||||||
const code = data.code;
|
const code = data.code;
|
||||||
|
|
||||||
|
|
|
@ -150,6 +150,7 @@
|
||||||
token: token,
|
token: token,
|
||||||
remember_me: remember_me
|
remember_me: remember_me
|
||||||
};
|
};
|
||||||
|
var x_plex_headers = getPlexHeaders();
|
||||||
data = $.extend(data, x_plex_headers);
|
data = $.extend(data, x_plex_headers);
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
|
|
@ -2301,6 +2301,7 @@ $(document).ready(function() {
|
||||||
$("#token_verify").html('<i class="fa fa-refresh fa-spin"></i>').fadeIn('fast');
|
$("#token_verify").html('<i class="fa fa-refresh fa-spin"></i>').fadeIn('fast');
|
||||||
}
|
}
|
||||||
function OAuthSuccessCallback(authToken) {
|
function OAuthSuccessCallback(authToken) {
|
||||||
|
var x_plex_headers = getPlexHeaders();
|
||||||
$("#pms_token").val(authToken);
|
$("#pms_token").val(authToken);
|
||||||
$("#pms_uuid").val(x_plex_headers['X-Plex-Client-Identifier']);
|
$("#pms_uuid").val(x_plex_headers['X-Plex-Client-Identifier']);
|
||||||
$("#token_verify").html('<i class="fa fa-check"></i>').fadeIn('fast');
|
$("#token_verify").html('<i class="fa fa-check"></i>').fadeIn('fast');
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue