mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-06 21:21:15 -07:00
Update Plex OAuth headers
This commit is contained in:
parent
f439bd639c
commit
72a012b817
1 changed files with 26 additions and 3 deletions
|
@ -568,8 +568,11 @@ function getPlexHeaders() {
|
||||||
'X-Plex-Client-Identifier': getLocalStorage('Tautulli_ClientID', uuidv4(), false),
|
'X-Plex-Client-Identifier': getLocalStorage('Tautulli_ClientID', uuidv4(), false),
|
||||||
'X-Plex-Platform': p.name,
|
'X-Plex-Platform': p.name,
|
||||||
'X-Plex-Platform-Version': p.version,
|
'X-Plex-Platform-Version': p.version,
|
||||||
|
'X-Plex-Model': 'Plex OAuth',
|
||||||
'X-Plex-Device': p.os,
|
'X-Plex-Device': p.os,
|
||||||
'X-Plex-Device-Name': p.name
|
'X-Plex-Device-Name': p.name,
|
||||||
|
'X-Plex-Device-Screen-Resolution': window.screen.width + 'x' + window.screen.height,
|
||||||
|
'X-Plex-Language': 'en'
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -655,7 +658,21 @@ function PlexOAuth(success, error, pre) {
|
||||||
const pin = data.pin;
|
const pin = data.pin;
|
||||||
const code = data.code;
|
const code = data.code;
|
||||||
|
|
||||||
plex_oauth_window.location = 'https://app.plex.tv/auth/#!?clientID=' + x_plex_headers['X-Plex-Client-Identifier'] + '&code=' + code;
|
var oauth_params = {
|
||||||
|
'clientID': x_plex_headers['X-Plex-Client-Identifier'],
|
||||||
|
'context[device][product]': x_plex_headers['X-Plex-Product'],
|
||||||
|
'context[device][version]': x_plex_headers['X-Plex-Version'],
|
||||||
|
'context[device][platform]': x_plex_headers['X-Plex-Platform'],
|
||||||
|
'context[device][platformVersion]': x_plex_headers['X-Plex-Platform-Version'],
|
||||||
|
'context[device][device]': x_plex_headers['X-Plex-Device'],
|
||||||
|
'context[device][deviceName]': x_plex_headers['X-Plex-Device-Name'],
|
||||||
|
'context[device][model]': x_plex_headers['X-Plex-Model'],
|
||||||
|
'context[device][screenResolution]': x_plex_headers['X-Plex-Device-Screen-Resolution'],
|
||||||
|
'context[device][layout]': 'desktop',
|
||||||
|
'code': code
|
||||||
|
}
|
||||||
|
|
||||||
|
plex_oauth_window.location = 'https://app.plex.tv/auth/#!?' + encodeData(oauth_params);
|
||||||
polling = pin;
|
polling = pin;
|
||||||
|
|
||||||
(function poll() {
|
(function poll() {
|
||||||
|
@ -693,4 +710,10 @@ function PlexOAuth(success, error, pre) {
|
||||||
error()
|
error()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function encodeData(data) {
|
||||||
|
return Object.keys(data).map(function(key) {
|
||||||
|
return [key, data[key]].map(encodeURIComponent).join("=");
|
||||||
|
}).join("&");
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue