mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-06 13:11:15 -07:00
Make local storage unique to Tautulli instance
This commit is contained in:
parent
1bce850765
commit
f2fedb182c
1 changed files with 8 additions and 8 deletions
|
@ -517,23 +517,23 @@ function PopupCenter(url, title, w, h) {
|
|||
return newWindow;
|
||||
}
|
||||
|
||||
function setLocalStorage(key, value) {
|
||||
|
||||
function setLocalStorage(key, value, path) {
|
||||
if (path !== false) {
|
||||
key = key + '_' + window.location.pathname;
|
||||
}
|
||||
localStorage.setItem(key, value);
|
||||
}
|
||||
function getLocalStorage(key, default_value) {
|
||||
function getLocalStorage(key, default_value, path) {
|
||||
var value = localStorage.getItem(key);
|
||||
if (value !== null) {
|
||||
return value
|
||||
} else if (default_value !== undefined) {
|
||||
setLocalStorage(key, default_value);
|
||||
setLocalStorage(key, default_value, path);
|
||||
return default_value
|
||||
}
|
||||
}
|
||||
|
||||
if (!getLocalStorage('Tautulli_ClientId')) {
|
||||
setLocalStorage('Tautulli_ClientId', uuidv4());
|
||||
}
|
||||
|
||||
function uuidv4() {
|
||||
return ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, function(c) {
|
||||
var cryptoObj = window.crypto || window.msCrypto; // for IE 11
|
||||
|
@ -545,7 +545,7 @@ var x_plex_headers = {
|
|||
'Accept': 'application/json',
|
||||
'X-Plex-Product': 'Tautulli',
|
||||
'X-Plex-Version': 'Plex OAuth',
|
||||
'X-Plex-Client-Identifier': localStorage.getItem('Tautulli_ClientId'),
|
||||
'X-Plex-Client-Identifier': getLocalStorage('Tautulli_ClientID', uuidv4(), false),
|
||||
'X-Plex-Platform': p.name,
|
||||
'X-Plex-Platform-Version': p.version,
|
||||
'X-Plex-Device': p.os,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue