fix(webhooks): Show webhooks panel only to admin users
All checks were successful
Build and Push Docker Image / build (push) Successful in 39s
Licence Check / Licence compatibility and copyright header verification (push) Successful in 57s
CI / Security audit (push) Successful in 1m4s
CI / Tests & coverage (push) Successful in 1m24s

This commit is contained in:
2026-05-19 20:36:33 +01:00
parent 0310f10e5d
commit 2d04402284

View File

@@ -302,6 +302,9 @@ function showDashboard() {
sp.style.display = 'none'; sp.style.display = 'none';
sp.innerHTML = ''; sp.innerHTML = '';
document.getElementById('admin-controls').style.display = isAdmin ? 'flex' : 'none'; document.getElementById('admin-controls').style.display = isAdmin ? 'flex' : 'none';
// Show webhooks section for admin users
const webhooksSection = document.getElementById('webhooks-section');
if (webhooksSection) webhooksSection.style.display = isAdmin ? '' : 'none';
// Initialise days input from saved value // Initialise days input from saved value
const daysInput = document.getElementById('history-days'); const daysInput = document.getElementById('history-days');
if (daysInput) daysInput.value = historyDays; if (daysInput) daysInput.value = historyDays;
@@ -1163,10 +1166,7 @@ function initWebhooks() {
const webhooksSection = document.getElementById('webhooks-section'); const webhooksSection = document.getElementById('webhooks-section');
if (!webhooksSection) return; if (!webhooksSection) return;
// Show webhooks section for admin users // Note: visibility is controlled by showDashboard() based on isAdmin
if (isAdmin) {
webhooksSection.style.display = '';
}
document.getElementById('webhooks-header').addEventListener('click', toggleWebhookSection); document.getElementById('webhooks-header').addEventListener('click', toggleWebhookSection);
document.getElementById('enable-sonarr-webhook').addEventListener('click', enableSonarrWebhook); document.getElementById('enable-sonarr-webhook').addEventListener('click', enableSonarrWebhook);