Compare commits

..

No commits in common. "36af2023de631f5e0fcdbc82064f0af4eb69b323" and "787f799ab1b0820d3bdc08316248235f42b4a11d" have entirely different histories.

3 changed files with 17 additions and 19 deletions

View File

@ -17,6 +17,8 @@ services:
environment: environment:
- FLASK_APP=app.py - FLASK_APP=app.py
- FLASK_ENV=production - FLASK_ENV=production
- TITLE_SHORT=${TITLE_SHORT}
- TITLE_LONG=${TITLE_LONG}
networks: networks:
- traefik - traefik
labels: labels:

View File

@ -101,34 +101,30 @@ audio.onended = function() {
async function downloadAudio() { async function downloadAudio() {
const src = audio.currentSrc || audio.src; const src = audio.currentSrc;
if (!src) return; if (!src) return;
// Build a fresh URL every time // Fetch with credentials / correct mode
const requestUrl = new URL(src, window.location.href); const response = await fetch(src, { credentials: 'same-origin' });
requestUrl.searchParams.set('_', Date.now()); if (!response.ok) throw new Error(`Download failed: ${response.status}`);
// Force network fetch and include sameorigin credentials // Grab the data as a Blob
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 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'); const a = document.createElement('a');
a.href = blobUrl; a.href = url;
// Retain original filename if possible // Retain original filename if possible
a.download = decodeURIComponent(src.split('/').pop() || 'audio'); let filename = decodeURIComponent(src.split('/').pop() || 'audio');
a.download = filename;
document.body.appendChild(a); document.body.appendChild(a);
a.click(); a.click();
document.body.removeChild(a); document.body.removeChild(a);
// Cleanup // Cleanup
URL.revokeObjectURL(blobUrl); URL.revokeObjectURL(url);
} }

View File

@ -1,4 +1,4 @@
const cacheName = 'gottesdienste-v1.7'; const cacheName = 'gottesdienste-v1.3';
const assets = [ const assets = [
'/', '/',
'/static/app.css', '/static/app.css',