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
+15 -15
View File
@@ -24,11 +24,11 @@ export function initHistoryControls() {
refreshBtn.addEventListener('click', () => loadHistory(true));
}
if (ignoreToggle) {
ignoreToggle.checked = ignoreAvailable;
ignoreToggle.checked = state.ignoreAvailable;
ignoreToggle.addEventListener('change', () => {
ignoreAvailable = ignoreToggle.checked;
saveIgnoreAvailable(ignoreAvailable);
renderHistory(lastHistoryItems);
state.ignoreAvailable = ignoreToggle.checked;
saveIgnoreAvailable(state.ignoreAvailable);
renderHistory(state.lastHistoryItems);
});
}
@@ -53,8 +53,8 @@ export function stopHistoryRefresh() {
export function clearHistory() {
state.lastHistoryItems = [];
document.getElementById('history-list').innerHTML = '';
document.getElementById('no-history').style.display = 'none';
document.getElementById('history-error').style.display = 'none';
document.getElementById('no-history').classList.add('hidden');
document.getElementById('history-error').classList.add('hidden');
}
export async function loadHistory(forceRefresh = false) {
@@ -63,24 +63,24 @@ export async function loadHistory(forceRefresh = false) {
const errorEl = document.getElementById('history-error');
const noHistoryEl = document.getElementById('no-history');
loadingEl.style.display = 'block';
errorEl.style.display = 'none';
noHistoryEl.style.display = 'none';
loadingEl.classList.remove('hidden');
errorEl.classList.add('hidden');
noHistoryEl.classList.add('hidden');
try {
const result = await apiLoadHistory(forceRefresh);
loadingEl.style.display = 'none';
loadingEl.classList.add('hidden');
if (result.success) {
state.lastHistoryItems = result.history;
renderHistory(state.lastHistoryItems);
} else {
errorEl.textContent = result.error || 'Failed to load history.';
errorEl.style.display = 'block';
errorEl.classList.remove('hidden');
}
} catch (err) {
loadingEl.style.display = 'none';
loadingEl.classList.add('hidden');
errorEl.textContent = 'Failed to load history.';
errorEl.style.display = 'block';
errorEl.classList.remove('hidden');
console.error('[History] Load error:', err);
}
}
@@ -93,10 +93,10 @@ export function renderHistory(items) {
? items.filter(item => !(item.outcome === 'failed' && item.availableForUpgrade))
: items;
if (!visible.length) {
noHistoryEl.style.display = 'block';
noHistoryEl.classList.remove('hidden');
return;
}
noHistoryEl.style.display = 'none';
noHistoryEl.classList.add('hidden');
visible.forEach(item => listEl.appendChild(createHistoryCard(item)));
}