fix(plex): use unique client identifier (#2602)

* fix(plex): use unique client identifier

As noted by SwiftPanda each client needs a unique identifier
https://discord.com/channels/783137440809746482/793885156569514046/950083089575583824

* fix(typo): fix character casing

Co-authored-by: TheCatLady <52870424+TheCatLady@users.noreply.github.com>

Co-authored-by: TheCatLady <52870424+TheCatLady@users.noreply.github.com>
pull/2550/head^2
Jakob Ankarhem 2 years ago committed by GitHub
parent 74d5c1ca67
commit 648b346cbe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -34,12 +34,24 @@ class PlexOAuth {
'Window is not defined. Are you calling this in the browser?'
);
}
let clientId = localStorage.getItem('overseerrPlexClientId');
if (!clientId) {
const uuid = crypto.randomUUID && crypto.randomUUID();
if (!uuid) {
throw new Error('Could not generate client ID');
}
localStorage.setItem('overseerrPlexClientId', uuid);
clientId = uuid;
}
const browser = Bowser.getParser(window.navigator.userAgent);
this.plexHeaders = {
Accept: 'application/json',
'X-Plex-Product': 'Overseerr',
'X-Plex-Version': '2.0',
'X-Plex-Client-Identifier': '7f9de3ba-e12b-11ea-87d0-0242ac130003',
'X-Plex-Client-Identifier': clientId,
'X-Plex-Model': 'Plex OAuth',
'X-Plex-Platform': browser.getOSName(),
'X-Plex-Platform-Version': browser.getOSVersion(),

Loading…
Cancel
Save