Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions backend/classes/jellyfin-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class JellyfinAPI {
this.#checkReadyStatus();
this.sessionErrorCounter = 0;
this.version = "1.0.0";
this.userAgent = "Jellystat/" + this.version;
}
//Helper classes
#checkReadyStatus() {
Expand Down Expand Up @@ -125,6 +126,7 @@ class JellyfinAPI {
const response = await axios.get(url, {
headers: {
Authorization: 'MediaBrowser Token="' + this.config.JF_API_KEY + '"',
"User-Agent": this.userAgent,
},
});
if (Array.isArray(response?.data)) {
Expand Down Expand Up @@ -184,6 +186,7 @@ class JellyfinAPI {
const response = await axios.get(url, {
headers: {
Authorization: 'MediaBrowser Token="' + this.config.JF_API_KEY + '"',
"User-Agent": this.userAgent,
},
params: {
fields: "MediaSources,DateCreated,Genres",
Expand Down Expand Up @@ -250,6 +253,7 @@ class JellyfinAPI {
const response = await axios.get(url, {
headers: {
Authorization: 'MediaBrowser Token="' + this.config.JF_API_KEY + '"',
"User-Agent": this.userAgent,
},
params: {
fields: "MediaSources,DateCreated,Genres",
Expand Down Expand Up @@ -318,6 +322,7 @@ class JellyfinAPI {
const response = await axios.get(url, {
headers: {
Authorization: 'MediaBrowser Token="' + this.config.JF_API_KEY + '"',
"User-Agent": this.userAgent,
},
});

Expand All @@ -341,6 +346,7 @@ class JellyfinAPI {
const response = await axios.get(url, {
headers: {
Authorization: 'MediaBrowser Token="' + this.config.JF_API_KEY + '"',
"User-Agent": this.userAgent,
},
});

Expand All @@ -366,6 +372,7 @@ class JellyfinAPI {
const response = await axios.get(url, {
headers: {
Authorization: 'MediaBrowser Token="' + this.config.JF_API_KEY + '"',
"User-Agent": this.userAgent,
},
});

Expand All @@ -389,6 +396,7 @@ class JellyfinAPI {
const response = await axios.get(url, {
headers: {
Authorization: 'MediaBrowser Token="' + this.config.JF_API_KEY + '"',
"User-Agent": this.userAgent,
},
});

Expand Down Expand Up @@ -433,6 +441,7 @@ class JellyfinAPI {
const response = await axios.get(url, {
headers: {
Authorization: 'MediaBrowser Token="' + this.config.JF_API_KEY + '"',
"User-Agent": this.userAgent,
},
params: {
fields: "MediaSources,DateCreated,Genres",
Expand Down Expand Up @@ -475,6 +484,7 @@ class JellyfinAPI {
.get(url, {
headers: {
Authorization: 'MediaBrowser Token="' + this.config.JF_API_KEY + '"',
"User-Agent": this.userAgent,
},
})
.then((response) => {
Expand Down Expand Up @@ -521,6 +531,7 @@ class JellyfinAPI {
const response = await axios.get(url, {
headers: {
Authorization: 'MediaBrowser Token="' + this.config.JF_API_KEY + '"',
"User-Agent": this.userAgent,
},
});
return response.data;
Expand Down Expand Up @@ -548,6 +559,7 @@ class JellyfinAPI {
{
headers: {
Authorization: 'MediaBrowser Token="' + this.config.JF_API_KEY + '"',
"User-Agent": this.userAgent,
},
}
);
Expand Down Expand Up @@ -589,6 +601,7 @@ class JellyfinAPI {
const response = await axios.get(validation_url, {
headers: {
Authorization: 'MediaBrowser Token="' + apikey + '"',
"User-Agent": this.userAgent,
},
});
result.isValid = response.status == 200;
Expand Down Expand Up @@ -616,6 +629,7 @@ class JellyfinAPI {
const response = await axios.get(url, {
headers: {
Authorization: 'MediaBrowser Token="' + this.config.JF_API_KEY + '"',
"User-Agent": this.userAgent,
},
});
return response?.data || {};
Expand Down
3 changes: 2 additions & 1 deletion backend/classes/sessions-socket-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ let keepAliveInterval;
function initializeClient(websocketUrl, apiKey) {
const options = {
headers: {
"Authorization": 'MediaBrowser Token="' + apiKey + '"'
"Authorization": 'MediaBrowser Token="' + apiKey + '"',
"User-Agent": "Jellystat/1.0.0"
}
};

Expand Down