templates/index.html aktualisiert
This commit is contained in:
@@ -159,10 +159,21 @@
|
|||||||
|
|
||||||
// 3. WebSockets
|
// 3. WebSockets
|
||||||
const logWs = new WebSocket(`ws://${location.host}/ws/install_logs`);
|
const logWs = new WebSocket(`ws://${location.host}/ws/install_logs`);
|
||||||
|
const logContainer = document.getElementById('install-log');
|
||||||
|
|
||||||
logWs.onmessage = (ev) => {
|
logWs.onmessage = (ev) => {
|
||||||
const l = document.getElementById('install-log');
|
// 1. Neues Element erstellen statt innerHTML +=
|
||||||
l.innerHTML += `<div>> ${ev.data}</div>`;
|
const div = document.createElement('div');
|
||||||
l.scrollTop = l.scrollHeight;
|
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`);
|
const chatWs = new WebSocket(`ws://${location.host}/ws/chat`);
|
||||||
|
|||||||
Reference in New Issue
Block a user