Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for per feed webhook #3112

Merged
merged 3 commits into from
Feb 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions internal/database/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -990,4 +990,8 @@ var migrations = []func(tx *sql.Tx, driver string) error{
_, err = tx.Exec(sql)
return err
},
func(tx *sql.Tx, _ string) (err error) {
_, err = tx.Exec(`ALTER TABLE feeds ADD COLUMN webhook_url text default '';`)
return err
},
}
13 changes: 10 additions & 3 deletions internal/integration/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -474,20 +474,27 @@ func PushEntries(feed *model.Feed, entries model.Entries, userIntegrations *mode
}

if userIntegrations.WebhookEnabled {
var webhookURL string
if feed.WebhookURL != "" {
webhookURL = feed.WebhookURL
} else {
webhookURL = userIntegrations.WebhookURL
}

slog.Debug("Sending new entries to Webhook",
slog.Int64("user_id", userIntegrations.UserID),
slog.Int("nb_entries", len(entries)),
slog.Int64("feed_id", feed.ID),
slog.String("webhook_url", userIntegrations.WebhookURL),
slog.String("webhook_url", webhookURL),
)

webhookClient := webhook.NewClient(userIntegrations.WebhookURL, userIntegrations.WebhookSecret)
webhookClient := webhook.NewClient(webhookURL, userIntegrations.WebhookSecret)
if err := webhookClient.SendNewEntriesWebhookEvent(feed, entries); err != nil {
slog.Debug("Unable to send new entries to Webhook",
slog.Int64("user_id", userIntegrations.UserID),
slog.Int("nb_entries", len(entries)),
slog.Int64("feed_id", feed.ID),
slog.String("webhook_url", userIntegrations.WebhookURL),
slog.String("webhook_url", webhookURL),
slog.Any("error", err),
)
}
Expand Down
5 changes: 3 additions & 2 deletions internal/locale/translations/de_DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@
"form.feed.label.scraper_rules": "Extraktionsregeln",
"form.feed.label.rewrite_rules": "Umschreiberegeln",
"form.feed.label.apprise_service_urls": "Kommaseparierte Liste der Apprise-Service-URLs",
"form.feed.label.webhook_url": "Webhook-URL überschreiben",
"form.feed.label.blocklist_rules": "Blockierregeln",
"form.feed.label.keeplist_rules": "Erlaubnisregeln",
"form.feed.label.urlrewrite_rules": "Umschreibregeln für URL",
Expand Down Expand Up @@ -501,8 +502,8 @@
"form.integration.shaarli_activate": "Artikel in Shaarli speichern",
"form.integration.shaarli_endpoint": "Shaarli-URL",
"form.integration.shaarli_api_secret": "Shaarli-API-Geheimnis",
"form.integration.webhook_activate": "Webhook aktivieren",
"form.integration.webhook_url": "Webhook-URL",
"form.integration.webhook_activate": "Webhooks aktivieren",
"form.integration.webhook_url": "Standard Webhook-URL",
"form.integration.webhook_secret": "Webhook-Geheimnis",
"form.integration.rssbridge_activate": "Beim Hinzufügen von Abonnements RSS-Bridge prüfen.",
"form.integration.rssbridge_url": "RSS-Bridge-Server-URL",
Expand Down
7 changes: 4 additions & 3 deletions internal/locale/translations/el_EL.json
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@
"error.feed_invalid_keeplist_rule": "Ο κανόνας keep list δεν είναι έγκυρος.",
"form.feed.label.urlrewrite_rules": "επανεγγραφή κανόνων για τη διεύθυνση URL.",
"form.feed.label.apprise_service_urls": "Comma separated list of Apprise service URLs",
"form.feed.label.webhook_url": "Override webhook url",
"error.user_mandatory_fields": "Το όνομα χρήστη είναι υποχρεωτικό.",
"error.api_key_already_exists": "Αυτό το κλειδί API υπάρχει ήδη.",
"error.unable_to_create_api_key": "Δεν είναι δυνατή η δημιουργία αυτού του κλειδιού API.",
Expand Down Expand Up @@ -501,9 +502,9 @@
"form.integration.shaarli_activate": "Save articles to Shaarli",
"form.integration.shaarli_endpoint": "Shaarli URL",
"form.integration.shaarli_api_secret": "Shaarli API Secret",
"form.integration.webhook_activate": "Enable Webhook",
"form.integration.webhook_url": "Webhook URL",
"form.integration.webhook_secret": "Webhook Secret",
"form.integration.webhook_activate": "Enable Webhooks",
"form.integration.webhook_url": "Default Webhook URL",
"form.integration.webhook_secret": "Webhooks Secret",
"form.integration.rssbridge_activate": "Check RSS-Bridge when adding subscriptions",
"form.integration.rssbridge_url": "RSS-Bridge server URL",
"form.integration.ntfy_activate": "Push entries to ntfy",
Expand Down
7 changes: 4 additions & 3 deletions internal/locale/translations/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@
"form.feed.label.scraper_rules": "Scraper Rules",
"form.feed.label.rewrite_rules": "Rewrite Rules",
"form.feed.label.apprise_service_urls": "Comma separated list of Apprise service URLs",
"form.feed.label.webhook_url": "Override webhook url",
"form.feed.label.blocklist_rules": "Block Rules",
"form.feed.label.keeplist_rules": "Keep Rules",
"form.feed.label.urlrewrite_rules": "URL Rewrite Rules",
Expand Down Expand Up @@ -499,9 +500,9 @@
"form.integration.shaarli_activate": "Save articles to Shaarli",
"form.integration.shaarli_endpoint": "Shaarli URL",
"form.integration.shaarli_api_secret": "Shaarli API Secret",
"form.integration.webhook_activate": "Enable Webhook",
"form.integration.webhook_url": "Webhook URL",
"form.integration.webhook_secret": "Webhook Secret",
"form.integration.webhook_activate": "Enable Webhooks",
"form.integration.webhook_url": "Default Webhook URL",
"form.integration.webhook_secret": "Webhooks Secret",
"form.integration.rssbridge_activate": "Check RSS-Bridge when adding subscriptions",
"form.integration.rssbridge_url": "RSS-Bridge server URL",
"form.integration.ntfy_activate": "Push entries to ntfy",
Expand Down
7 changes: 4 additions & 3 deletions internal/locale/translations/es_ES.json
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@
"form.feed.label.scraper_rules": "Reglas de extracción de información",
"form.feed.label.rewrite_rules": "Reglas de reescribir",
"form.feed.label.apprise_service_urls": "Lista separada por comas de las URL del servicio Apprise",
"form.feed.label.webhook_url": "Override webhook url",
"form.feed.label.blocklist_rules": "Reglas de Filtrado (Bloquear)",
"form.feed.label.keeplist_rules": "Reglas de Filtrado (Permitir)",
"form.feed.label.urlrewrite_rules": "Reglas de Filtrado (Reescritura)",
Expand Down Expand Up @@ -501,9 +502,9 @@
"form.integration.shaarli_activate": "Guardar artículos en Shaarli",
"form.integration.shaarli_endpoint": "URL de Shaarli",
"form.integration.shaarli_api_secret": "Secreto API de Shaarli",
"form.integration.webhook_activate": "Habilitar Webhook",
"form.integration.webhook_url": "URL de Webhook",
"form.integration.webhook_secret": "Secreto de Webhook",
"form.integration.webhook_activate": "Habilitar Webhooks",
"form.integration.webhook_url": "Defecto URL de Webhook",
"form.integration.webhook_secret": "Secreto de Webhooks",
"form.integration.rssbridge_activate": "Vericar RSS-Bridge al agregar suscripciones",
"form.integration.rssbridge_url": "URL del servidro RSS-Bridge",
"form.integration.ntfy_activate": "Enviar artículos a ntfy",
Expand Down
7 changes: 4 additions & 3 deletions internal/locale/translations/fi_FI.json
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@
"error.feed_invalid_keeplist_rule": "The keep list rule is invalid.",
"form.feed.label.urlrewrite_rules": "URL-osoitteen uudelleenkirjoitussäännöt",
"form.feed.label.apprise_service_urls": "Comma separated list of Apprise service URLs",
"form.feed.label.webhook_url": "Override webhook url",
"error.user_mandatory_fields": "Käyttäjätunnus on pakollinen.",
"error.api_key_already_exists": "API-avain on jo olemassa.",
"error.unable_to_create_api_key": "API-avainta ei voi luoda.",
Expand Down Expand Up @@ -501,9 +502,9 @@
"form.integration.shaarli_activate": "Save articles to Shaarli",
"form.integration.shaarli_endpoint": "Shaarli URL",
"form.integration.shaarli_api_secret": "Shaarli API Secret",
"form.integration.webhook_activate": "Enable Webhook",
"form.integration.webhook_url": "Webhook URL",
"form.integration.webhook_secret": "Webhook Secret",
"form.integration.webhook_activate": "Enable Webhooks",
"form.integration.webhook_url": "Default Webhook URL",
"form.integration.webhook_secret": "Webhooks Secret",
"form.integration.rssbridge_activate": "Check RSS-Bridge when adding subscriptions",
"form.integration.rssbridge_url": "RSS-Bridge server URL",
"form.integration.ntfy_activate": "Push entries to ntfy",
Expand Down
1 change: 1 addition & 0 deletions internal/locale/translations/fr_FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@
"form.feed.label.scraper_rules": "Règles pour récupérer le contenu original",
"form.feed.label.rewrite_rules": "Règles de réécriture",
"form.feed.label.apprise_service_urls": "Liste séparée par des virgules des URL du service Apprise",
"form.feed.label.webhook_url": "Remplacer l'URL du webhook",
"form.feed.label.blocklist_rules": "Règles de blocage",
"form.feed.label.keeplist_rules": "Règles d'autorisation",
"form.feed.label.urlrewrite_rules": "Règles de réécriture d'URL",
Expand Down
7 changes: 4 additions & 3 deletions internal/locale/translations/hi_IN.json
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@
"form.feed.label.scraper_rules": "खुरचनी नियम",
"form.feed.label.rewrite_rules": "नियम फिर से लिखें",
"form.feed.label.apprise_service_urls": "Comma separated list of Apprise service URLs",
"form.feed.label.webhook_url": "Override webhook url",
"form.feed.label.blocklist_rules": "ब्लॉक नियम",
"form.feed.label.keeplist_rules": "नियम बनाए रखें",
"form.feed.label.urlrewrite_rules": " यूआरएल पुनर्लेखन नियम",
Expand Down Expand Up @@ -501,9 +502,9 @@
"form.integration.shaarli_activate": "Save articles to Shaarli",
"form.integration.shaarli_endpoint": "Shaarli URL",
"form.integration.shaarli_api_secret": "Shaarli API Secret",
"form.integration.webhook_activate": "Enable Webhook",
"form.integration.webhook_url": "Webhook URL",
"form.integration.webhook_secret": "Webhook Secret",
"form.integration.webhook_activate": "Enable Webhooks",
"form.integration.webhook_url": "Default Webhook URL",
"form.integration.webhook_secret": "Webhooks Secret",
"form.integration.rssbridge_activate": "Check RSS-Bridge when adding subscriptions",
"form.integration.rssbridge_url": "RSS-Bridge server URL",
"form.integration.ntfy_activate": "Push entries to ntfy",
Expand Down
7 changes: 4 additions & 3 deletions internal/locale/translations/id_ID.json
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@
"form.feed.label.scraper_rules": "Aturan Pengambil Data",
"form.feed.label.rewrite_rules": "Aturan Tulis Ulang",
"form.feed.label.apprise_service_urls": "Comma separated list of Apprise service URLs",
"form.feed.label.webhook_url": "Override webhook url",
"form.feed.label.blocklist_rules": "Aturan Blokir",
"form.feed.label.keeplist_rules": "Aturan Simpan",
"form.feed.label.urlrewrite_rules": "Aturan Tulis Ulang URL",
Expand Down Expand Up @@ -491,9 +492,9 @@
"form.integration.shaarli_activate": "Save articles to Shaarli",
"form.integration.shaarli_endpoint": "Shaarli URL",
"form.integration.shaarli_api_secret": "Shaarli API Secret",
"form.integration.webhook_activate": "Enable Webhook",
"form.integration.webhook_url": "Webhook URL",
"form.integration.webhook_secret": "Webhook Secret",
"form.integration.webhook_activate": "Enable Webhooks",
"form.integration.webhook_url": "Default Webhook URL",
"form.integration.webhook_secret": "Webhooks Secret",
"form.integration.rssbridge_activate": "Check RSS-Bridge when adding subscriptions",
"form.integration.rssbridge_url": "RSS-Bridge server URL",
"form.integration.ntfy_activate": "Push entries to ntfy",
Expand Down
7 changes: 4 additions & 3 deletions internal/locale/translations/it_IT.json
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@
"form.feed.label.scraper_rules": "Regole di estrazione del contenuto",
"form.feed.label.rewrite_rules": "Regole di impaginazione del contenuto",
"form.feed.label.apprise_service_urls": "Comma separated list of Apprise service URLs",
"form.feed.label.webhook_url": "Override webhook url",
"form.feed.label.blocklist_rules": "Regole di blocco",
"form.feed.label.keeplist_rules": "Regole di autorizzazione",
"form.feed.label.urlrewrite_rules": "Regole di riscrittura URL",
Expand Down Expand Up @@ -501,9 +502,9 @@
"form.integration.shaarli_activate": "Save articles to Shaarli",
"form.integration.shaarli_endpoint": "Shaarli URL",
"form.integration.shaarli_api_secret": "Shaarli API Secret",
"form.integration.webhook_activate": "Enable Webhook",
"form.integration.webhook_url": "Webhook URL",
"form.integration.webhook_secret": "Webhook Secret",
"form.integration.webhook_activate": "Enable Webhooks",
"form.integration.webhook_url": "Default Webhook URL",
"form.integration.webhook_secret": "Webhooks Secret",
"form.integration.rssbridge_activate": "Check RSS-Bridge when adding subscriptions",
"form.integration.rssbridge_url": "RSS-Bridge server URL",
"form.api_key.label.description": "Etichetta chiave API",
Expand Down
7 changes: 4 additions & 3 deletions internal/locale/translations/ja_JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@
"form.feed.label.keeplist_rules": "Keep ルール",
"form.feed.label.urlrewrite_rules": "Rewrite URL ルール",
"form.feed.label.apprise_service_urls": "Comma separated list of Apprise service URLs",
"form.feed.label.webhook_url": "Override webhook url",
"form.feed.label.ignore_http_cache": "HTTPキャッシュを無視",
"form.feed.label.allow_self_signed_certificates": "自己署名証明書または無効な証明書を許可する",
"form.feed.label.disable_http2": "Disable HTTP/2 to avoid fingerprinting",
Expand Down Expand Up @@ -491,9 +492,9 @@
"form.integration.shaarli_activate": "Save articles to Shaarli",
"form.integration.shaarli_endpoint": "Shaarli URL",
"form.integration.shaarli_api_secret": "Shaarli API Secret",
"form.integration.webhook_activate": "Enable Webhook",
"form.integration.webhook_url": "Webhook URL",
"form.integration.webhook_secret": "Webhook Secret",
"form.integration.webhook_activate": "Enable Webhooks",
"form.integration.webhook_url": "Default Webhook URL",
"form.integration.webhook_secret": "Webhooks Secret",
"form.integration.rssbridge_activate": "Check RSS-Bridge when adding subscriptions",
"form.integration.rssbridge_url": "RSS-Bridge server URL",
"form.integration.ntfy_activate": "Push entries to ntfy",
Expand Down
7 changes: 4 additions & 3 deletions internal/locale/translations/nl_NL.json
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@
"form.feed.label.keeplist_rules": "Bewaarregels",
"form.feed.label.urlrewrite_rules": "Herschrijfregels voor URL's",
"form.feed.label.apprise_service_urls": "Door komma's gescheiden lijst van Apprise service URL's",
"form.feed.label.webhook_url": "Overschrijf webhook URL",
"form.feed.label.ignore_http_cache": "Negeer HTTP-cache",
"form.feed.label.allow_self_signed_certificates": "Zelfondertekende of ongeldige certificaten toestaan",
"form.feed.label.disable_http2": "HTTP/2 uitschakelen om fingerprinting te voorkomen",
Expand Down Expand Up @@ -501,9 +502,9 @@
"form.integration.shaarli_activate": "Artikelen opslaan in Shaarli",
"form.integration.shaarli_endpoint": "Shaarli URL",
"form.integration.shaarli_api_secret": "Shaarli API Secret",
"form.integration.webhook_activate": "Webhook activeren",
"form.integration.webhook_url": "Webhook URL",
"form.integration.webhook_secret": "Webhook Secret",
"form.integration.webhook_activate": "Webhooks activeren",
"form.integration.webhook_url": "Standard Webhook URL",
"form.integration.webhook_secret": "Webhooks Secret",
"form.integration.rssbridge_activate": "Controleer RSS-Bridge bij het toevoegen van abonnementen",
"form.integration.rssbridge_url": "RSS-Bridge server URL",
"form.integration.ntfy_activate": "Stuur artikelen naar ntfy",
Expand Down
7 changes: 4 additions & 3 deletions internal/locale/translations/pl_PL.json
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@
"form.feed.label.keeplist_rules": "Reguły utrzymywania",
"form.feed.label.urlrewrite_rules": "Reguły przepisywania adresów URL",
"form.feed.label.apprise_service_urls": "Rozdzielana przecinkami lista adresów URL usług Appprise",
"form.feed.label.webhook_url": "Override webhook url",
"form.feed.label.ignore_http_cache": "Zignoruj pamięć podręczną HTTP",
"form.feed.label.allow_self_signed_certificates": "Zezwalaj na samopodpisane lub nieprawidłowe certyfikaty",
"form.feed.label.disable_http2": "Wyłącz protokół HTTP/2, aby uniknąć identyfikowania",
Expand Down Expand Up @@ -511,9 +512,9 @@
"form.integration.shaarli_activate": "Zapisuj artykuły w Shaarli",
"form.integration.shaarli_endpoint": "Adres URL Shaarli",
"form.integration.shaarli_api_secret": "Tajny klucz API do Shaarli",
"form.integration.webhook_activate": "Włącz Webhook",
"form.integration.webhook_url": "Adres URL Webhook",
"form.integration.webhook_secret": "Tajny klucz do Webhook",
"form.integration.webhook_activate": "Włącz Webhooks",
"form.integration.webhook_url": "Default Adres URL Webhook",
"form.integration.webhook_secret": "Tajny klucz do Webhooks",
"form.integration.rssbridge_activate": "Sprawdź RSS-Bridge podczas dodawania subskrypcji",
"form.integration.rssbridge_url": "Adres URL serwera RSS-Bridge",
"form.integration.ntfy_activate": "Przesyłaj wpisy do ntfy",
Expand Down
7 changes: 4 additions & 3 deletions internal/locale/translations/pt_BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@
"form.feed.label.keeplist_rules": "Regras de permissão",
"form.feed.label.urlrewrite_rules": "Regras de reescrita de URL",
"form.feed.label.apprise_service_urls": "Comma separated list of Apprise service URLs",
"form.feed.label.webhook_url": "Override webhook url",
"form.feed.label.ignore_http_cache": "Ignorar cache HTTP",
"form.feed.label.allow_self_signed_certificates": "Permitir certificados autoassinados ou inválidos",
"form.feed.label.disable_http2": "Disable HTTP/2 to avoid fingerprinting",
Expand Down Expand Up @@ -501,9 +502,9 @@
"form.integration.shaarli_activate": "Save articles to Shaarli",
"form.integration.shaarli_endpoint": "Shaarli URL",
"form.integration.shaarli_api_secret": "Shaarli API Secret",
"form.integration.webhook_activate": "Enable Webhook",
"form.integration.webhook_url": "Webhook URL",
"form.integration.webhook_secret": "Webhook Secret",
"form.integration.webhook_activate": "Enable Webhooks",
"form.integration.webhook_url": "Default Webhook URL",
"form.integration.webhook_secret": "Webhooks Secret",
"form.integration.rssbridge_activate": "Check RSS-Bridge when adding subscriptions",
"form.integration.rssbridge_url": "RSS-Bridge server URL",
"form.integration.ntfy_activate": "Push entries to ntfy",
Expand Down
1 change: 1 addition & 0 deletions internal/locale/translations/ru_RU.json
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@
"form.feed.label.keeplist_rules": "Правила белого списка",
"form.feed.label.urlrewrite_rules": "Правила перезаписи URL",
"form.feed.label.apprise_service_urls": "Список ссылок сервисов Apprise, разделенный запятой",
"form.feed.label.webhook_url": "Override webhook url",
"form.feed.label.ignore_http_cache": "Игнорировать HTTP кеш",
"form.feed.label.allow_self_signed_certificates": "Разрешить самоподписанные или недействительные сертификаты",
"form.feed.label.disable_http2": "Disable HTTP/2 to avoid fingerprinting",
Expand Down
5 changes: 3 additions & 2 deletions internal/locale/translations/tr_TR.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@
"form.feed.fieldset.rules": "Kurallar",
"form.feed.label.allow_self_signed_certificates": "Kendinden imzalı veya geçersiz sertifikalara izin ver",
"form.feed.label.apprise_service_urls": "Apprise hizmet URL'lerinin virgülle ayrılmış listesi",
"form.feed.label.webhook_url": "Override webhook url",
"form.feed.label.blocklist_rules": "Engelleme Kuralları",
"form.feed.label.category": "Kategori",
"form.feed.label.cookie": "Çerezleri Ayarla",
Expand Down Expand Up @@ -270,8 +271,8 @@
"form.integration.wallabag_password": "Wallabag Parolası",
"form.integration.wallabag_username": "Wallabag Kullanıcı Adı",
"form.integration.webhook_activate": "Webhook'u etkinleştir",
"form.integration.webhook_secret": "Webhook Secret",
"form.integration.webhook_url": "Webhook URL",
"form.integration.webhook_secret": "Webhooks Secret",
"form.integration.webhook_url": "Default Webhook URL",
"form.integration.ntfy_activate": "Push entries to ntfy",
"form.integration.ntfy_topic": "Ntfy topic",
"form.integration.ntfy_url": "Ntfy URL (optional, default is ntfy.sh)",
Expand Down
Loading