1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Merge pull request #5730 from Doxterpepper/remove-caching-system-info

Add no-cache attribute for fetch requests to /system/info/public to prevent stale server info
This commit is contained in:
Bill Thornton 2024-08-13 10:19:50 -04:00 committed by GitHub
commit a0e6da790c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 4 additions and 4 deletions

View file

@ -83,7 +83,7 @@ const ConnectionRequired: FunctionComponent<ConnectionRequiredProps> = ({
if (firstConnection.State === ConnectionState.ServerSignIn) {
// Verify the wizard is complete
try {
const infoResponse = await fetch(`${firstConnection.ApiClient.serverAddress()}/System/Info/Public`);
const infoResponse = await fetch(`${firstConnection.ApiClient.serverAddress()}/System/Info/Public`, { cache: 'no-cache' });
if (!infoResponse.ok) {
throw new Error('Public system info request failed');
}

View file

@ -387,7 +387,7 @@ class AppRouter {
if (firstResult) {
if (firstResult.State === ConnectionState.ServerSignIn) {
const url = firstResult.ApiClient.serverAddress() + '/System/Info/Public';
fetch(url).then(response => {
fetch(url, { cache: 'no-cache' }).then(response => {
if (!response.ok) return Promise.reject('fetch failed');
return response.json();
}).then(data => {

View file

@ -24,7 +24,7 @@ export const getSystemInfoQuery = (
api?: Api
) => queryOptions({
queryKey: [ 'SystemInfo' ],
queryFn: ({ signal }) => fetchSystemInfo(api, { signal }),
queryFn: ({ signal }) => fetchSystemInfo(api, { signal, headers: { 'Cache-Control': 'no-cache' } }),
// Allow for query reuse in legacy javascript.
staleTime: 1000, // 1 second
enabled: !!api

View file

@ -52,7 +52,7 @@ export async function serverAddress() {
console.debug('URL candidates:', urls);
const promises = urls.map(url => {
return fetch(`${url}/System/Info/Public`)
return fetch(`${url}/System/Info/Public`, { cache: 'no-cache' })
.then(async resp => {
if (!resp.ok) {
return;