|
|
@@ -6030,6 +6030,13 @@ function getPlexHeaders(){
|
|
|
'X-Plex-Product': activeInfo.appearance.title,
|
|
|
'X-Plex-Version': '2.0',
|
|
|
'X-Plex-Client-Identifier': activeInfo.settings.misc.uuid,
|
|
|
+ 'X-Plex-Model': 'Plex OAuth',
|
|
|
+ 'X-Plex-Platform': activeInfo.osName,
|
|
|
+ 'X-Plex-Platform-Version': activeInfo.osVersion,
|
|
|
+ 'X-Plex-Device': activeInfo.browserName,
|
|
|
+ 'X-Plex-Device-Name': activeInfo.browserVersion,
|
|
|
+ 'X-Plex-Device-Screen-Resolution': window.screen.width + 'x' + window.screen.height,
|
|
|
+ 'X-Plex-Language': 'en'
|
|
|
};
|
|
|
}
|
|
|
var plex_oauth_window = null;
|
|
|
@@ -6107,7 +6114,20 @@ function PlexOAuth(success, error, pre) {
|
|
|
var x_plex_headers = getPlexHeaders();
|
|
|
const pin = data.pin;
|
|
|
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;
|
|
|
(function poll() {
|
|
|
$.ajax({
|
|
|
@@ -6145,6 +6165,11 @@ function PlexOAuth(success, error, pre) {
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
+function encodeData(data) {
|
|
|
+ return Object.keys(data).map(function(key) {
|
|
|
+ return [key, data[key]].map(encodeURIComponent).join("=");
|
|
|
+ }).join("&");
|
|
|
+}
|
|
|
function oAuthSuccess(type,token){
|
|
|
switch(type) {
|
|
|
case 'plex':
|