Fix CSP violations and ignoreAvailable reference error
Build and Push Docker Image / build (push) Successful in 27s
Licence Check / Licence compatibility and copyright header verification (push) Failing after 40s
CI / Security audit (push) Successful in 54s
CI / Tests & coverage (push) Successful in 1m7s

- 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:
2026-05-21 00:33:57 +01:00
parent ddebe96056
commit f02c30efde
10 changed files with 163 additions and 90 deletions
+22 -17
View File
@@ -11,7 +11,7 @@ export function fadeOutLogin() {
const login = document.getElementById('login-container');
login.classList.add('fade-out');
login.addEventListener('transitionend', () => {
login.style.display = 'none';
login.classList.add('hidden');
login.classList.remove('fade-out');
resolve();
}, { once: true });
@@ -20,7 +20,7 @@ export function fadeOutLogin() {
export function showSplash() {
const splash = document.getElementById('splash-screen');
splash.style.display = 'flex';
splash.classList.remove('hidden');
splash.style.opacity = '1';
splash.classList.remove('fade-out');
}
@@ -36,12 +36,12 @@ export function dismissSplash(startTime) {
// transitionend never fires (e.g. display was toggled in same frame)
const TRANSITION_MS = 400;
const fallback = setTimeout(() => {
splash.style.display = 'none';
splash.classList.add('hidden');
resolve();
}, TRANSITION_MS + 100);
splash.addEventListener('transitionend', () => {
clearTimeout(fallback);
splash.style.display = 'none';
splash.classList.add('hidden');
resolve();
}, { once: true });
}, remaining);
@@ -115,22 +115,27 @@ export async function handleLogoutClick() {
}
export function showLogin() {
document.getElementById('login-container').style.display = 'flex';
document.getElementById('dashboard-container').style.display = 'none';
document.getElementById('login-container').classList.remove('hidden');
document.getElementById('dashboard-container').classList.add('hidden');
hideLoginError();
}
export function showDashboard() {
document.getElementById('login-container').style.display = 'none';
document.getElementById('dashboard-container').style.display = 'block';
document.getElementById('login-container').classList.add('hidden');
document.getElementById('dashboard-container').classList.remove('hidden');
document.getElementById('currentUser').textContent = state.currentUser.name || '-';
// Always start with status panel hidden (guards against stale display value on re-login)
const sp = document.getElementById('status-panel');
sp.style.display = 'none';
sp.classList.add('hidden');
// Also hide webhooks-section to keep them in sync (both show/hide together)
const webhooksSection = document.getElementById('webhooks-section');
if (webhooksSection) webhooksSection.style.display = 'none';
document.getElementById('admin-controls').style.display = state.isAdmin ? 'flex' : 'none';
if (webhooksSection) webhooksSection.classList.add('hidden');
const adminControls = document.getElementById('admin-controls');
if (state.isAdmin) {
adminControls.classList.remove('hidden');
} else {
adminControls.classList.add('hidden');
}
// Note: webhooks-section visibility is controlled by toggleStatusPanel()
// Initialise days input from saved value
const daysInput = document.getElementById('history-days');
@@ -141,31 +146,31 @@ export function showDashboard() {
export function showLoginError(message) {
const errorDiv = document.getElementById('login-error');
errorDiv.textContent = message;
errorDiv.style.display = 'block';
errorDiv.classList.remove('hidden');
}
export function hideLoginError() {
const errorDiv = document.getElementById('login-error');
errorDiv.style.display = 'none';
errorDiv.classList.add('hidden');
}
export function showError(message) {
const errorDiv = document.getElementById('error-message');
errorDiv.textContent = message;
errorDiv.style.display = 'block';
errorDiv.classList.remove('hidden');
}
export function hideError() {
const errorDiv = document.getElementById('error-message');
errorDiv.style.display = 'none';
errorDiv.classList.add('hidden');
}
export function showLoading() {
const loading = document.getElementById('loading');
loading.style.display = 'block';
loading.classList.remove('hidden');
}
export function hideLoading() {
const loading = document.getElementById('loading');
loading.style.display = 'none';
loading.classList.add('hidden');
}