cosnole
This commit is contained in:
@@ -353,29 +353,37 @@
|
|||||||
}
|
}
|
||||||
return;
|
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);
|
const formData = new FormData(consoleForm);
|
||||||
if (presetSelect) formData.set('terminal_preset_id', '');
|
if (presetSelect) formData.set('terminal_preset_id', '');
|
||||||
const url = new URL(window.location.href);
|
const url = new URL(window.location.href);
|
||||||
url.searchParams.set('send_active_json', '1');
|
url.searchParams.set('open_console_json', '1');
|
||||||
fetch(url.toString(), { method: 'POST', body: formData, cache: 'no-store' })
|
fetch(url.toString(), { method: 'POST', body: formData, cache: 'no-store' })
|
||||||
.then((res) => res.json())
|
.then((res) => res.json())
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
if (data.ok) {
|
if (!data.ok) {
|
||||||
if (consoleNotice) {
|
if (consoleNotice) {
|
||||||
consoleNotice.textContent = data.notice || 'Befehl wurde in der bestehenden Konsole ausgeführt.';
|
consoleNotice.textContent = data.error || 'Befehl konnte nicht ausgeführt werden.';
|
||||||
consoleNotice.style.display = 'block';
|
consoleNotice.style.display = 'block';
|
||||||
}
|
}
|
||||||
if (consoleError) consoleError.style.display = 'none';
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (consoleNotice) {
|
if (data.url) {
|
||||||
consoleNotice.textContent = data.error || 'Befehl konnte nicht in der bestehenden Konsole ausgeführt werden.';
|
activeIframe.src = data.url;
|
||||||
consoleNotice.style.display = 'block';
|
|
||||||
}
|
}
|
||||||
|
if (consoleError) consoleError.style.display = 'none';
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
if (consoleNotice) {
|
if (consoleNotice) {
|
||||||
consoleNotice.textContent = 'Befehl konnte nicht in der bestehenden Konsole ausgeführt werden.';
|
consoleNotice.textContent = 'Befehl konnte nicht ausgeführt werden.';
|
||||||
consoleNotice.style.display = 'block';
|
consoleNotice.style.display = 'block';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user