From a8d5d16db2c1d8eeb7ec021c8a7dd7cf7c11509d Mon Sep 17 00:00:00 2001 From: claude-dev Date: Sun, 8 Mar 2026 16:51:13 +0100 Subject: [PATCH] Fix: formatDate-Kollision, implizites event, onclick-Escaping MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - formatDate() in source-health.js zu formatDateTime() umbenannt, damit app.js formatDate() nicht überschrieben wird - searchFix(): data-Attribute statt inline onclick-String (XSS-sicher) - searchFix(btn): expliziter Parameter statt implizites event.target Co-Authored-By: Claude Opus 4.6 --- src/static/js/source-health.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/static/js/source-health.js b/src/static/js/source-health.js index 7527f2e..1630435 100644 --- a/src/static/js/source-health.js +++ b/src/static/js/source-health.js @@ -87,7 +87,7 @@ function renderHealthDashboard() { ${esc(s.title)} ${esc(s.description || "")} ${PRIORITY_LABELS[s.priority] || s.priority} - ${formatDate(s.created_at)} + ${formatDateTime(s.created_at)} @@ -127,7 +127,7 @@ function renderHealthDashboard() { ${SUGGESTION_TYPE_LABELS[s.suggestion_type] || s.suggestion_type} ${esc(s.title)} ${s.status === "accepted" ? "Angenommen" : "Abgelehnt"} - ${formatDate(s.reviewed_at)} + ${formatDateTime(s.reviewed_at)} `, ) .join("")} @@ -148,7 +148,7 @@ function renderHealthDashboard() {

Health-Check Ergebnisse

- Letzter Check: ${healthData.last_check ? formatDate(healthData.last_check) : "Noch nie"} + Letzter Check: ${healthData.last_check ? formatDateTime(healthData.last_check) : "Noch nie"}  |  ${healthData.errors} Fehler   ${healthData.warnings} Warnungen   @@ -173,7 +173,7 @@ function renderHealthDashboard() { ${CHECK_TYPE_LABELS[c.check_type] || c.check_type} ${c.status === "error" ? "Fehler" : "Warnung"} ${esc(c.message)} - ${c.status === "error" && c.check_type === "reachability" ? \`\` : ""} + ${c.status === "error" && c.check_type === "reachability" ? \`\` : ""} `, ) .join("")} @@ -243,7 +243,7 @@ async function runHealthCheck() { } // --- Hilfsfunktionen --- -function formatDate(dateStr) { +function formatDateTime(dateStr) { if (!dateStr) return "-"; try { const d = new Date(dateStr); @@ -261,10 +261,11 @@ function formatDate(dateStr) { // --- Sonnet-Recherche für kaputte Quelle --- -async function searchFix(sourceId, sourceName) { +async function searchFix(btn) { + const sourceId = btn.dataset.sourceId; + const sourceName = btn.dataset.sourceName; if (!confirm(`Sonnet mit WebSearch nach einer Lösung für "${sourceName}" suchen lassen?\n\nDas nutzt Kontingent vom Max-Abo (~$3-4).`)) return; - const btn = event.target; btn.disabled = true; btn.textContent = "Sucht...";