Merge branch 'development' of gitea.centx.de:lelo/bethaus-app into development
This commit is contained in:
commit
2c6b856f66
@ -17,8 +17,6 @@ services:
|
||||
environment:
|
||||
- FLASK_APP=app.py
|
||||
- FLASK_ENV=production
|
||||
- TITLE_SHORT=${TITLE_SHORT}
|
||||
- TITLE_LONG=${TITLE_LONG}
|
||||
networks:
|
||||
- traefik
|
||||
labels:
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
const cacheName = 'gottesdienste-v1.3';
|
||||
const cacheName = 'gottesdienste-v1.7';
|
||||
const assets = [
|
||||
'/',
|
||||
'/static/app.css',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user