fix(webhooks): Show webhooks panel only to admin users
All checks were successful
All checks were successful
This commit is contained in:
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user