debug und oidc
This commit is contained in:
@@ -5,5 +5,26 @@
|
|||||||
<div class="footer-right">Security first · Internal only</div>
|
<div class="footer-right">Security first · Internal only</div>
|
||||||
</footer>
|
</footer>
|
||||||
<?php asset_scripts('footer'); ?>
|
<?php asset_scripts('footer'); ?>
|
||||||
|
<?php if (defined('APP_DEBUG_TOOL') && APP_DEBUG_TOOL): ?>
|
||||||
|
<div class="debug-modal" id="debug-modal" aria-hidden="true">
|
||||||
|
<div class="debug-modal__backdrop" data-debug-close></div>
|
||||||
|
<div class="debug-modal__panel card">
|
||||||
|
<div class="debug-modal__header">
|
||||||
|
<strong>Debug Logs</strong>
|
||||||
|
<button class="debug-modal__close" data-debug-close type="button">✕</button>
|
||||||
|
</div>
|
||||||
|
<div class="debug-modal__body">
|
||||||
|
<div class="debug-modal__list">
|
||||||
|
<div class="muted">Logs</div>
|
||||||
|
<ul id="debug-log-list"></ul>
|
||||||
|
</div>
|
||||||
|
<div class="debug-modal__content">
|
||||||
|
<div class="muted">Inhalt</div>
|
||||||
|
<pre id="debug-log-content"></pre>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -102,5 +102,5 @@ $sidebarItems = $moduleSidebar['items'] ?? [];
|
|||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<?php if (defined('APP_DEBUG_TOOL') && APP_DEBUG_TOOL): ?>
|
<?php if (defined('APP_DEBUG_TOOL') && APP_DEBUG_TOOL): ?>
|
||||||
<a class="debug-fab" href="/debug" title="Debug">🐞</a>
|
<button class="debug-fab" data-debug-open title="Debug" type="button">🐞</button>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|||||||
@@ -239,6 +239,71 @@ body {
|
|||||||
font-size: 22px;
|
font-size: 22px;
|
||||||
box-shadow: 0 16px 32px rgba(255, 90, 61, 0.28);
|
box-shadow: 0 16px 32px rgba(255, 90, 61, 0.28);
|
||||||
z-index: 50;
|
z-index: 50;
|
||||||
|
border: none;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.debug-modal {
|
||||||
|
position: fixed;
|
||||||
|
inset: 0;
|
||||||
|
display: none;
|
||||||
|
z-index: 80;
|
||||||
|
}
|
||||||
|
.debug-modal.is-open { display: block; }
|
||||||
|
.debug-modal__backdrop {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
background: rgba(10, 12, 20, 0.35);
|
||||||
|
}
|
||||||
|
.debug-modal__panel {
|
||||||
|
position: relative;
|
||||||
|
max-width: 980px;
|
||||||
|
width: calc(100% - 40px);
|
||||||
|
margin: 60px auto;
|
||||||
|
padding: 16px;
|
||||||
|
}
|
||||||
|
.debug-modal__header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
.debug-modal__close {
|
||||||
|
background: transparent;
|
||||||
|
border: none;
|
||||||
|
font-size: 20px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.debug-modal__body {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 220px 1fr;
|
||||||
|
gap: 16px;
|
||||||
|
}
|
||||||
|
.debug-modal__list ul {
|
||||||
|
list-style: none;
|
||||||
|
padding: 0;
|
||||||
|
margin: 8px 0 0;
|
||||||
|
display: grid;
|
||||||
|
gap: 6px;
|
||||||
|
}
|
||||||
|
.debug-modal__list a {
|
||||||
|
text-decoration: none;
|
||||||
|
color: var(--text);
|
||||||
|
padding: 6px 8px;
|
||||||
|
border-radius: 8px;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.debug-modal__list a:hover { background: var(--panel-2); }
|
||||||
|
.debug-modal__content pre {
|
||||||
|
background: var(--panel-2);
|
||||||
|
padding: 10px;
|
||||||
|
border-radius: 8px;
|
||||||
|
max-height: 520px;
|
||||||
|
overflow: auto;
|
||||||
|
white-space: pre-wrap;
|
||||||
|
}
|
||||||
|
@media (max-width: 800px) {
|
||||||
|
.debug-modal__body { grid-template-columns: 1fr; }
|
||||||
}
|
}
|
||||||
|
|
||||||
.muted { color: var(--muted); }
|
.muted { color: var(--muted); }
|
||||||
|
|||||||
@@ -27,3 +27,57 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
(() => {
|
||||||
|
const openBtn = document.querySelector('[data-debug-open]');
|
||||||
|
const modal = document.getElementById('debug-modal');
|
||||||
|
if (!openBtn || !modal) return;
|
||||||
|
|
||||||
|
const listEl = document.getElementById('debug-log-list');
|
||||||
|
const contentEl = document.getElementById('debug-log-content');
|
||||||
|
const closeEls = modal.querySelectorAll('[data-debug-close]');
|
||||||
|
|
||||||
|
const open = () => {
|
||||||
|
modal.classList.add('is-open');
|
||||||
|
modal.setAttribute('aria-hidden', 'false');
|
||||||
|
loadList();
|
||||||
|
};
|
||||||
|
const close = () => {
|
||||||
|
modal.classList.remove('is-open');
|
||||||
|
modal.setAttribute('aria-hidden', 'true');
|
||||||
|
};
|
||||||
|
|
||||||
|
const loadList = async () => {
|
||||||
|
try {
|
||||||
|
const res = await fetch('/debug?list=1', { cache: 'no-store' });
|
||||||
|
const files = await res.json();
|
||||||
|
listEl.innerHTML = '';
|
||||||
|
files.forEach((f) => {
|
||||||
|
const a = document.createElement('a');
|
||||||
|
a.href = '#';
|
||||||
|
a.textContent = f;
|
||||||
|
a.addEventListener('click', (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
loadFile(f);
|
||||||
|
});
|
||||||
|
const li = document.createElement('li');
|
||||||
|
li.appendChild(a);
|
||||||
|
listEl.appendChild(li);
|
||||||
|
});
|
||||||
|
if (files.includes('oidc_login.log')) {
|
||||||
|
loadFile('oidc_login.log');
|
||||||
|
}
|
||||||
|
} catch (e) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
const loadFile = async (name) => {
|
||||||
|
try {
|
||||||
|
const res = await fetch(`/debug?raw=1&file=${encodeURIComponent(name)}`, { cache: 'no-store' });
|
||||||
|
const text = await res.text();
|
||||||
|
contentEl.textContent = text;
|
||||||
|
} catch (e) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
openBtn.addEventListener('click', open);
|
||||||
|
closeEls.forEach((el) => el.addEventListener('click', close));
|
||||||
|
})();
|
||||||
|
|||||||
@@ -28,6 +28,12 @@ if ($selected !== '' && preg_match('/^[a-zA-Z0-9._-]+$/', $selected)) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($_GET['list']) && $_GET['list'] === '1') {
|
||||||
|
header('Content-Type: application/json; charset=utf-8');
|
||||||
|
echo json_encode($files);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($_GET['raw']) && $_GET['raw'] === '1') {
|
if (isset($_GET['raw']) && $_GET['raw'] === '1') {
|
||||||
header('Content-Type: text/plain; charset=utf-8');
|
header('Content-Type: text/plain; charset=utf-8');
|
||||||
echo $content ?? '';
|
echo $content ?? '';
|
||||||
|
|||||||
Reference in New Issue
Block a user