templates/index.html aktualisiert
This commit is contained in:
@@ -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 += `<div>> ${ev.data}</div>`;
|
||||
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`);
|
||||
|
||||
Reference in New Issue
Block a user