diff --git a/partials/structure/layout_end.php b/partials/structure/layout_end.php index 7111a29..126bd31 100755 --- a/partials/structure/layout_end.php +++ b/partials/structure/layout_end.php @@ -5,5 +5,26 @@ + + + diff --git a/partials/structure/layout_start.php b/partials/structure/layout_start.php index fa0be00..123a252 100755 --- a/partials/structure/layout_start.php +++ b/partials/structure/layout_start.php @@ -102,5 +102,5 @@ $sidebarItems = $moduleSidebar['items'] ?? []; - ๐Ÿž + diff --git a/public/assets/css/app.css b/public/assets/css/app.css index d5fb4e0..84ba159 100644 --- a/public/assets/css/app.css +++ b/public/assets/css/app.css @@ -239,6 +239,71 @@ body { font-size: 22px; box-shadow: 0 16px 32px rgba(255, 90, 61, 0.28); 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); } diff --git a/public/assets/js/app.js b/public/assets/js/app.js index 7b53938..c260e43 100755 --- a/public/assets/js/app.js +++ b/public/assets/js/app.js @@ -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)); +})(); diff --git a/public/page/debug.php b/public/page/debug.php index 0e54e9e..ea35f95 100644 --- a/public/page/debug.php +++ b/public/page/debug.php @@ -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') { header('Content-Type: text/plain; charset=utf-8'); echo $content ?? '';