From d8e58e553ab94a821ed1889359d46a415f8210b6 Mon Sep 17 00:00:00 2001 From: "mula.liu" Date: Tue, 20 Jan 2026 12:36:44 +0800 Subject: [PATCH] fix bugs --- docker-compose.yml | 2 +- nginx.conf | 6 ++++++ utils/parsers.ts | 6 +++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 636b082..057b263 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,7 +5,7 @@ services: build: . container_name: nex-music-web ports: - - "80:80" + - "8081:80" restart: always # If you want to mount the .env file dynamically or valid it locally # env_file: diff --git a/nginx.conf b/nginx.conf index 7fa0008..341f508 100644 --- a/nginx.conf +++ b/nginx.conf @@ -18,4 +18,10 @@ server { expires 1y; 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; + } } \ No newline at end of file diff --git a/utils/parsers.ts b/utils/parsers.ts index 33b4dff..32d9e0e 100644 --- a/utils/parsers.ts +++ b/utils/parsers.ts @@ -56,12 +56,16 @@ const resolveUrl = (url: string, baseUrl: string) => { export const fetchPlaylist = async (url: string): Promise => { try { + // Append timestamp to avoid cache + const cacheBuster = `t=${new Date().getTime()}`; + const urlWithCache = url.includes('?') ? `${url}&${cacheBuster}` : `${url}?${cacheBuster}`; + let response; let fetchError; // 1. Try direct fetch first try { - response = await fetch(url); + response = await fetch(urlWithCache); if (!response.ok) throw new Error('Direct fetch status not ok'); } catch (e) { console.warn("Direct fetch failed, attempting proxy fallback 1.", e);