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; }