Fix CSP violations and ignoreAvailable reference error
- Add .hidden utility class to style.css for CSP compliance - Replace all inline style='display: none' with class='hidden' in HTML - Update all UI modules to use classList.add/remove instead of style.display - Fix ignoreAvailable reference error in history.js (use state.ignoreAvailable) - Rebuild client bundle with vite
This commit is contained in:
@@ -7,24 +7,24 @@ import { fetchWebhookStatus } from './webhooks.js';
|
||||
export async function toggleStatusPanel() {
|
||||
const panel = document.getElementById('status-panel');
|
||||
const webhooksSection = document.getElementById('webhooks-section');
|
||||
if (panel.style.display !== 'none') {
|
||||
if (!panel.classList.contains('hidden')) {
|
||||
// Close both panels (webhooks is a sibling, hide it too)
|
||||
panel.style.display = 'none';
|
||||
if (webhooksSection) webhooksSection.style.display = 'none';
|
||||
panel.classList.add('hidden');
|
||||
if (webhooksSection) webhooksSection.classList.add('hidden');
|
||||
if (state.statusRefreshHandle) { clearInterval(state.statusRefreshHandle); state.statusRefreshHandle = null; }
|
||||
return;
|
||||
}
|
||||
// Open status panel and webhooks section (siblings)
|
||||
panel.style.display = 'block';
|
||||
panel.classList.remove('hidden');
|
||||
// Show webhooks section for admin users (collapsed by default)
|
||||
if (webhooksSection && state.isAdmin) {
|
||||
webhooksSection.style.display = 'block';
|
||||
webhooksSection.classList.remove('hidden');
|
||||
state.webhookSectionExpanded = false;
|
||||
document.getElementById('webhooks-content').style.display = 'none';
|
||||
document.getElementById('webhooks-content').classList.add('hidden');
|
||||
document.getElementById('webhooks-toggle').classList.remove('expanded');
|
||||
await fetchWebhookStatus();
|
||||
} else if (webhooksSection) {
|
||||
webhooksSection.style.display = 'none';
|
||||
webhooksSection.classList.add('hidden');
|
||||
}
|
||||
refreshStatusPanel();
|
||||
if (state.statusRefreshHandle) clearInterval(state.statusRefreshHandle);
|
||||
@@ -32,9 +32,9 @@ export async function toggleStatusPanel() {
|
||||
}
|
||||
|
||||
export function closeStatusPanel() {
|
||||
document.getElementById('status-panel').style.display = 'none';
|
||||
document.getElementById('status-panel').classList.add('hidden');
|
||||
const webhooksSection = document.getElementById('webhooks-section');
|
||||
if (webhooksSection) webhooksSection.style.display = 'none';
|
||||
if (webhooksSection) webhooksSection.classList.add('hidden');
|
||||
if (state.statusRefreshHandle) { clearInterval(state.statusRefreshHandle); state.statusRefreshHandle = null; }
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ export async function refreshStatusPanel() {
|
||||
const panel = document.getElementById('status-panel');
|
||||
const contentDiv = document.getElementById('status-content');
|
||||
console.log('[Status] panel found:', !!panel, 'contentDiv found:', !!contentDiv, 'panel display:', panel?.style?.display);
|
||||
if (!panel || panel.style.display === 'none') return;
|
||||
if (!panel || panel.classList.contains('hidden')) return;
|
||||
console.log('[Status] Refreshing status panel...');
|
||||
try {
|
||||
const result = await apiRefreshStatusPanel();
|
||||
|
||||
Reference in New Issue
Block a user