CONSOLE
This commit is contained in:
@@ -330,7 +330,6 @@
|
||||
|
||||
const openBtn = consoleForm.querySelector('[data-open-console]');
|
||||
const runBtn = consoleForm.querySelector('[data-run-command]');
|
||||
const sendBtn = consoleForm.querySelector('[data-send-active]');
|
||||
if (openBtn) {
|
||||
openBtn.addEventListener('click', (e) => {
|
||||
e.preventDefault();
|
||||
@@ -343,51 +342,6 @@
|
||||
submitRun();
|
||||
});
|
||||
}
|
||||
if (sendBtn) {
|
||||
sendBtn.addEventListener('click', (e) => {
|
||||
e.preventDefault();
|
||||
if (!commandTextarea || !commandTextarea.value.trim()) {
|
||||
if (consoleError) {
|
||||
consoleError.textContent = 'Bitte zuerst einen Befehl eingeben.';
|
||||
consoleError.style.display = 'block';
|
||||
}
|
||||
return;
|
||||
}
|
||||
const activeIframe = getActiveIframe();
|
||||
if (!activeIframe) {
|
||||
if (consoleNotice) {
|
||||
consoleNotice.textContent = 'Keine aktive Konsole – es wird eine neue Konsole geöffnet.';
|
||||
consoleNotice.style.display = 'block';
|
||||
}
|
||||
submitOpen();
|
||||
return;
|
||||
}
|
||||
const formData = new FormData(consoleForm);
|
||||
if (presetSelect) formData.set('terminal_preset_id', '');
|
||||
const url = new URL(window.location.href);
|
||||
url.searchParams.set('open_console_json', '1');
|
||||
fetch(url.toString(), { method: 'POST', body: formData, cache: 'no-store' })
|
||||
.then((res) => res.json())
|
||||
.then((data) => {
|
||||
if (!data.ok) {
|
||||
if (consoleNotice) {
|
||||
consoleNotice.textContent = data.error || 'Befehl konnte nicht ausgeführt werden.';
|
||||
consoleNotice.style.display = 'block';
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (data.url) {
|
||||
activeIframe.src = data.url;
|
||||
}
|
||||
if (consoleError) consoleError.style.display = 'none';
|
||||
})
|
||||
.catch(() => {
|
||||
if (consoleNotice) {
|
||||
consoleNotice.textContent = 'Befehl konnte nicht ausgeführt werden.';
|
||||
consoleNotice.style.display = 'block';
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
// send-active removed
|
||||
}
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user