From 5d16b902ccbbe98bab7a322d41b93cb9dfcc586f Mon Sep 17 00:00:00 2001 From: Gmer4Lfe Date: Sun, 14 Jun 2026 21:34:54 -0400 Subject: [PATCH] Extend download webhook to all grabs, not just upgrades; add DOWNLOAD_WEBHOOK_ENABLED toggle --- Plugin/unraid/api/webhook.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/Plugin/unraid/api/webhook.php b/Plugin/unraid/api/webhook.php index e590008..af798a0 100644 --- a/Plugin/unraid/api/webhook.php +++ b/Plugin/unraid/api/webhook.php @@ -1,5 +1,5 @@ true, 'message' => 'Webhook connected — configure On Upgrade to use this URL']); + echo json_encode(['ok' => true, 'message' => 'Webhook connected — configure On Download to use this URL']); exit; } -// Sonarr/Radarr/Lidarr fire eventType "Download" with isUpgrade=true for upgrades. -// A plain Download (no upgrade) is not our concern — the original quality is fine. -$is_upgrade = $payload['isUpgrade'] ?? false; -if ($event !== 'Download' || !$is_upgrade) { +$vars = vv_conf_vars(); +$enabled = strtolower($vars['DOWNLOAD_WEBHOOK_ENABLED'] ?? 'true') !== 'false'; +if (!$enabled) { + echo json_encode(['ok' => true, 'skipped' => 'DOWNLOAD_WEBHOOK_ENABLED=false']); + exit; +} + +// Fire on any Download event — new grabs and upgrades both need immediate propagation +// so remote nodes don't search for something we already have. +if ($event !== 'Download') { echo json_encode(['ok' => true, 'skipped' => $event]); exit; }