diff --git a/templates/index.html b/templates/index.html index ffb69f5..c8aee55 100644 --- a/templates/index.html +++ b/templates/index.html @@ -159,10 +159,21 @@ // 3. WebSockets const logWs = new WebSocket(`ws://${location.host}/ws/install_logs`); + const logContainer = document.getElementById('install-log'); + logWs.onmessage = (ev) => { - const l = document.getElementById('install-log'); - l.innerHTML += `
> ${ev.data}
`; - l.scrollTop = l.scrollHeight; + // 1. Neues Element erstellen statt innerHTML += + const div = document.createElement('div'); + div.textContent = `> ${ev.data}`; + logContainer.appendChild(div); + + // 2. Zeilen begrenzen (z.B. max 500 Zeilen behalten) + if (logContainer.childNodes.length > 500) { + logContainer.removeChild(logContainer.firstChild); + } + + // 3. Auto-Scroll nur wenn wir am Ende sind (optional, aber CPU-schonend) + logContainer.scrollTop = logContainer.scrollHeight; }; const chatWs = new WebSocket(`ws://${location.host}/ws/chat`);