Compare commits

..

No commits in common. "cffb4ec9e28192e9ac08d86d7d77bb1b3cb8f361" and "882d3404b9c9352b16c5feffb2965b6b115af23f" have entirely different histories.

3 changed files with 17 additions and 30 deletions

View File

@ -292,7 +292,7 @@ document.querySelectorAll('.play-file').forEach(link => {
title: currentMusicFiles[currentMusicIndex].title, title: currentMusicFiles[currentMusicIndex].title,
artist: folderName, artist: folderName,
artwork: [ artwork: [
{ src: '/icons/logo-192x192.png', sizes: '192x192', type: 'image/png' } { src: '/static/icons/logo-192x192.png', sizes: '192x192', type: 'image/png' }
] ]
}); });
} }

View File

@ -98,33 +98,20 @@ audio.onended = function() {
playerButton.innerHTML = playIcon; playerButton.innerHTML = playIcon;
}; };
function downloadAudio() {
// Get the current audio source URL
async function downloadAudio() { const audioSrc = audio.currentSrc || audio.src;
const src = audio.currentSrc; if (audioSrc) {
if (!src) return; // Create a temporary link element
const a = document.createElement('a');
// Fetch with credentials / correct mode a.href = audioSrc;
const response = await fetch(src, { credentials: 'same-origin' }); // Extract the file name from the URL, decode it, and set as download attribute
if (!response.ok) throw new Error(`Download failed: ${response.status}`); let fileName = audioSrc.split('/').pop() || 'audio';
fileName = decodeURIComponent(fileName);
// Grab the data as a Blob a.download = fileName;
const blob = await response.blob(); document.body.appendChild(a);
a.click();
// Create your own blob: URL and anchor document.body.removeChild(a);
const url = URL.createObjectURL(blob); }
const a = document.createElement('a');
a.href = url;
// Retain original filename if possible
let filename = decodeURIComponent(src.split('/').pop() || 'audio');
a.download = filename;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
// Cleanup
URL.revokeObjectURL(url);
} }

View File

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