feat(webhook): implement Phase 1 webhook receiver for Sonarr and Radarr
All checks were successful
Build and Push Docker Image / build (push) Successful in 1m7s
Licence Check / Licence compatibility and copyright header verification (push) Successful in 1m15s
CI / Security audit (push) Successful in 1m44s
CI / Tests & coverage (push) Successful in 1m53s

- Added POST /api/webhook/sonarr and POST /api/webhook/radarr endpoints
- Implemented webhook secret validation via SOFARR_WEBHOOK_SECRET environment variable
- Added logging for all incoming webhook events using existing logToFile utility
- Returns HTTP 200 immediately to prevent webhook retries
- Mounted webhook routes before CSRF middleware (called by external services)
- Non-breaking: no changes to polling, caching, SSE, or any existing behavior
- Lays groundwork for Phase 2 (cache + SSE integration) without implementing it yet
This commit is contained in:
2026-05-19 15:15:53 +01:00
parent 934f5e3fd5
commit 99ddb05dbe
4 changed files with 106 additions and 0 deletions

View File

@@ -19,6 +19,16 @@ LOG_LEVEL=info
# Generate with: openssl rand -hex 32
COOKIE_SECRET=your-cookie-secret-here
# =============================================================================
# WEBHOOK SETTINGS
# =============================================================================
# Secret for validating incoming webhooks from Sonarr and Radarr
# Required for webhook endpoints to accept requests
# Sonarr/Radarr must send this secret in the X-Sofarr-Webhook-Secret header
# Generate with: openssl rand -hex 32
SOFARR_WEBHOOK_SECRET=your-webhook-secret-here
# =============================================================================
# TLS / HTTPS
# =============================================================================