diff --git a/docker-compose.yml b/docker-compose.yml index b55bb90..17ab8ff 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -17,8 +17,6 @@ services: environment: - FLASK_APP=app.py - FLASK_ENV=production - - TITLE_SHORT=${TITLE_SHORT} - - TITLE_LONG=${TITLE_LONG} networks: - traefik labels: diff --git a/static/audioplayer.js b/static/audioplayer.js index aec10af..e8b541c 100644 --- a/static/audioplayer.js +++ b/static/audioplayer.js @@ -101,30 +101,34 @@ audio.onended = function() { async function downloadAudio() { - const src = audio.currentSrc; + const src = audio.currentSrc || audio.src; if (!src) return; - // Fetch with credentials / correct mode - const response = await fetch(src, { credentials: 'same-origin' }); - if (!response.ok) throw new Error(`Download failed: ${response.status}`); + // Build a fresh URL every time + const requestUrl = new URL(src, window.location.href); + requestUrl.searchParams.set('_', Date.now()); - // Grab the data as a Blob + // Force network fetch and include same‑origin credentials + const response = await fetch(requestUrl.toString(), { + credentials: 'same-origin', + cache: 'no-store' + }); + if (!response.ok) { + throw new Error(`Download failed: ${response.status}`); + } + + // Turn the response into a blob, then download it const blob = await response.blob(); + const blobUrl = URL.createObjectURL(blob); - // Create your own blob: URL and anchor - const url = URL.createObjectURL(blob); const a = document.createElement('a'); - a.href = url; - + a.href = blobUrl; // Retain original filename if possible - let filename = decodeURIComponent(src.split('/').pop() || 'audio'); - a.download = filename; + a.download = decodeURIComponent(src.split('/').pop() || 'audio'); document.body.appendChild(a); a.click(); document.body.removeChild(a); // Cleanup - URL.revokeObjectURL(url); + URL.revokeObjectURL(blobUrl); } - - diff --git a/static/sw.js b/static/sw.js index 2e3e9c2..eb02061 100644 --- a/static/sw.js +++ b/static/sw.js @@ -1,4 +1,4 @@ -const cacheName = 'gottesdienste-v1.3'; +const cacheName = 'gottesdienste-v1.7'; const assets = [ '/', '/static/app.css',