fix: add source link in history

This commit is contained in:
2025-12-23 20:15:46 +01:00
parent 6f4d943e3d
commit 91a2565ec2
2 changed files with 18 additions and 9 deletions
+16 -8
View File
@@ -235,7 +235,7 @@ document.addEventListener('DOMContentLoaded', () => {
function loadHistory() { function loadHistory() {
const raw = localStorage.getItem('mdl_history'); const raw = localStorage.getItem('mdl_history');
if(!raw) { if(!raw) {
dom.historyTableBody.innerHTML = '<tr><td colspan="4" class="text-center text-white-50 py-3">Kein Verlauf vorhanden</td></tr>'; dom.historyTableBody.innerHTML = '<tr><td colspan="5" class="text-center text-white-50 py-3">Kein Verlauf vorhanden</td></tr>';
return; return;
} }
@@ -258,10 +258,15 @@ document.addEventListener('DOMContentLoaded', () => {
tr.innerHTML = ` tr.innerHTML = `
<td class="ps-4 text-white-50 small font-monospace">${time}</td> <td class="ps-4 text-white-50 small font-monospace">${time}</td>
<td class="text-center text-primary-light small">${item.platform}</td> <td class="text-center text-primary-light small">${item.platform}</td>
<td class="text-truncate" style="max-width: 150px;">${item.title || 'Unbekannt'}</td> <td class="text-truncate" style="max-width: 150px;" title="${item.title}">${item.title || 'Unbekannt'}</td>
<td class="text-center">
<a href="${item.source}" target="_blank" class="text-white-50" title="Quelle öffnen: ${item.source}">
<i class="fas fa-link"></i>
</a>
</td>
<td class="text-end pe-4"> <td class="text-end pe-4">
<a href="${item.url}" target="_blank" class="text-primary-light"> <a href="${item.url}" target="_blank" class="text-primary-light" title="Download">
<i class="fas fa-external-link-alt"></i> <i class="fas fa-download"></i>
</a> </a>
</td> </td>
`; `;
@@ -269,18 +274,21 @@ document.addEventListener('DOMContentLoaded', () => {
}); });
} }
function saveHistory(url) { function saveHistory(resultUrl) {
const pf = dom.platformInput.value; const pf = dom.platformInput.value;
const sourceUrl = dom.urlInput.value; // Hole die Original-URL aus dem Input
const entry = { const entry = {
url: url, url: resultUrl, // Der fertige S3 Download Link
source: sourceUrl, // Der ursprüngliche YouTube/etc Link
platform: pf, platform: pf,
title: pf + " Download", // Could be improved if backend sent title title: pf + " Download", // (Backend sendet Titel aktuell nicht im finalen Status, daher generisch)
ts: Date.now() ts: Date.now()
}; };
let data = JSON.parse(localStorage.getItem('mdl_history') || '[]'); let data = JSON.parse(localStorage.getItem('mdl_history') || '[]');
data.unshift(entry); data.unshift(entry);
if(data.length > 20) data.pop(); if(data.length > 20) data.pop(); // Max 20 Einträge
localStorage.setItem('mdl_history', JSON.stringify(data)); localStorage.setItem('mdl_history', JSON.stringify(data));
loadHistory(); loadHistory();
} }
+2 -1
View File
@@ -179,7 +179,8 @@
<th class="ps-4">Zeit</th> <th class="ps-4">Zeit</th>
<th class="text-center">Typ</th> <th class="text-center">Typ</th>
<th>Titel</th> <th>Titel</th>
<th class="text-end pe-4">Link</th> <th class="text-center">Quelle</th> <!-- NEU: Quelle Spalte -->
<th class="text-end pe-4">Download</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>