mirror of
https://github.com/sct/overseerr.git
synced 2025-09-17 17:24:35 +02:00
fix(plex): correctly generate uuid for safari (#2614)
This commit is contained in:

committed by
GitHub

parent
086f0b6ce2
commit
d06f2cdb08
@@ -20,6 +20,19 @@ export interface PlexPin {
|
|||||||
code: string;
|
code: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const uuidv4 = (): string => {
|
||||||
|
return ((1e7).toString() + -1e3 + -4e3 + -8e3 + -1e11).replace(
|
||||||
|
/[018]/g,
|
||||||
|
function (c) {
|
||||||
|
return (
|
||||||
|
parseInt(c) ^
|
||||||
|
(window.crypto.getRandomValues(new Uint8Array(1))[0] &
|
||||||
|
(15 >> (parseInt(c) / 4)))
|
||||||
|
).toString(16);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
class PlexOAuth {
|
class PlexOAuth {
|
||||||
private plexHeaders?: PlexHeaders;
|
private plexHeaders?: PlexHeaders;
|
||||||
|
|
||||||
@@ -37,11 +50,7 @@ class PlexOAuth {
|
|||||||
|
|
||||||
let clientId = localStorage.getItem('overseerrPlexClientId');
|
let clientId = localStorage.getItem('overseerrPlexClientId');
|
||||||
if (!clientId) {
|
if (!clientId) {
|
||||||
const uuid = crypto.randomUUID && crypto.randomUUID();
|
const uuid = uuidv4();
|
||||||
if (!uuid) {
|
|
||||||
throw new Error('Could not generate client ID');
|
|
||||||
}
|
|
||||||
|
|
||||||
localStorage.setItem('overseerrPlexClientId', uuid);
|
localStorage.setItem('overseerrPlexClientId', uuid);
|
||||||
clientId = uuid;
|
clientId = uuid;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user