Webseite überarbeitet und Telegram Bot funktion hinzugefügt #1
@@ -275,6 +275,7 @@
|
||||
<script>
|
||||
let currentSettings = {};
|
||||
let termDataDisposable = null;
|
||||
let term, fitAddon;
|
||||
|
||||
// 1. CHAT LOGIK
|
||||
function initChat(chatWs) {
|
||||
@@ -454,10 +455,29 @@
|
||||
localStorage.setItem('pi-orch-layout-v2', JSON.stringify(grid.save(false)));
|
||||
});
|
||||
|
||||
const term = new Terminal({ theme: { background: '#000' }, fontSize: 13, convertEol: true });
|
||||
const fitAddon = new FitAddon.FitAddon();
|
||||
// Terminal Setup
|
||||
term = new Terminal({ theme: { background: '#000' }, fontSize: 13, convertEol: true });
|
||||
fitAddon = new FitAddon.FitAddon();
|
||||
term.loadAddon(fitAddon);
|
||||
term.open(document.getElementById('terminal'));
|
||||
fitAddon.fit();
|
||||
|
||||
// WICHTIG: Wenn das Widget in GridStack vergrößert wird
|
||||
grid.on('resizestop', function(event, el) {
|
||||
if (el.getAttribute('gs-id') === 'term-widget') {
|
||||
setTimeout(() => {
|
||||
fitAddon.fit();
|
||||
// Sende neue Größe an das Backend
|
||||
if (window.termWs && window.termWs.readyState === WebSocket.OPEN) {
|
||||
window.termWs.send(JSON.stringify({
|
||||
type: "resize",
|
||||
cols: term.cols,
|
||||
rows: term.rows
|
||||
}));
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
});
|
||||
|
||||
const logWs = new WebSocket(`ws://${location.host}/ws/install_logs`);
|
||||
logWs.onmessage = (ev) => {
|
||||
@@ -482,10 +502,26 @@
|
||||
if (window.termWs) window.termWs.close();
|
||||
if (termDataDisposable) termDataDisposable.dispose();
|
||||
term.clear();
|
||||
fitAddon.fit(); // Einmal anpassen beim Öffnen
|
||||
|
||||
window.termWs = new WebSocket(`ws://${location.host}/ws/terminal/${ip}`);
|
||||
|
||||
window.termWs.onopen = () => {
|
||||
// Initiale Größe nach dem Verbinden senden
|
||||
window.termWs.send(JSON.stringify({
|
||||
type: "resize",
|
||||
cols: term.cols,
|
||||
rows: term.rows
|
||||
}));
|
||||
};
|
||||
|
||||
window.termWs.onmessage = (ev) => term.write(ev.data);
|
||||
|
||||
termDataDisposable = term.onData(data => {
|
||||
if (window.termWs?.readyState === WebSocket.OPEN) window.termWs.send(data);
|
||||
if (window.termWs?.readyState === WebSocket.OPEN) {
|
||||
// Normale Tastatureingaben senden wir direkt
|
||||
window.termWs.send(data);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user