This commit is contained in:
2025-12-27 02:56:19 +01:00
parent 68b063b9d6
commit 3a86863d42
2 changed files with 14 additions and 1 deletions

View File

@@ -89,8 +89,15 @@ if ($debugEnabled) {
const file = select.value;
if (!file) { content.innerHTML = '<p class="muted">Log auswählen, um Inhalt zu sehen.</p>'; return; }
fetch('/debug?file=' + encodeURIComponent(file) + '&raw=1')
.then(r => r.text())
.then(r => {
if (!r.ok) throw new Error('Request failed');
return r.text();
})
.then(text => {
if (!text.trim()) {
content.innerHTML = '<p class="muted">Log ist leer.</p>';
return;
}
const escape = (s) => s
.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')

View File

@@ -26,6 +26,12 @@ if ($selected && in_array($selected, $files, true)) {
// Raw delivery for AJAX view (no layout, plain text)
if (isset($_GET['raw']) && $_GET['raw'] === '1') {
if (!$selected || !in_array($selected, $files, true)) {
http_response_code(404);
header('Content-Type: text/plain; charset=utf-8');
echo 'Log nicht gefunden.';
exit;
}
header('Content-Type: text/plain; charset=utf-8');
echo $content;
exit;