fix bugs
parent
15b970e6fa
commit
d8e58e553a
|
|
@ -5,7 +5,7 @@ services:
|
||||||
build: .
|
build: .
|
||||||
container_name: nex-music-web
|
container_name: nex-music-web
|
||||||
ports:
|
ports:
|
||||||
- "80:80"
|
- "8081:80"
|
||||||
restart: always
|
restart: always
|
||||||
# If you want to mount the .env file dynamically or valid it locally
|
# If you want to mount the .env file dynamically or valid it locally
|
||||||
# env_file:
|
# env_file:
|
||||||
|
|
|
||||||
|
|
@ -18,4 +18,10 @@ server {
|
||||||
expires 1y;
|
expires 1y;
|
||||||
add_header Cache-Control "public, no-transform";
|
add_header Cache-Control "public, no-transform";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Do not cache JSON data files
|
||||||
|
location ~* \.json$ {
|
||||||
|
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
||||||
|
expires 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -56,12 +56,16 @@ const resolveUrl = (url: string, baseUrl: string) => {
|
||||||
|
|
||||||
export const fetchPlaylist = async (url: string): Promise<TrackData[]> => {
|
export const fetchPlaylist = async (url: string): Promise<TrackData[]> => {
|
||||||
try {
|
try {
|
||||||
|
// Append timestamp to avoid cache
|
||||||
|
const cacheBuster = `t=${new Date().getTime()}`;
|
||||||
|
const urlWithCache = url.includes('?') ? `${url}&${cacheBuster}` : `${url}?${cacheBuster}`;
|
||||||
|
|
||||||
let response;
|
let response;
|
||||||
let fetchError;
|
let fetchError;
|
||||||
|
|
||||||
// 1. Try direct fetch first
|
// 1. Try direct fetch first
|
||||||
try {
|
try {
|
||||||
response = await fetch(url);
|
response = await fetch(urlWithCache);
|
||||||
if (!response.ok) throw new Error('Direct fetch status not ok');
|
if (!response.ok) throw new Error('Direct fetch status not ok');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.warn("Direct fetch failed, attempting proxy fallback 1.", e);
|
console.warn("Direct fetch failed, attempting proxy fallback 1.", e);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue