debug und oidc
This commit is contained in:
@@ -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));
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user