mirror of
https://github.com/miniflux/v2.git
synced 2025-08-06 17:41:00 +00:00
feat(integration): prioritize feed-level webhook URL when available when saving entries
This commit is contained in:
parent
181e1341e1
commit
1f7843e313
2 changed files with 12 additions and 3 deletions
|
@ -372,20 +372,27 @@ func SendEntry(entry *model.Entry, userIntegrations *model.Integration) {
|
|||
}
|
||||
|
||||
if userIntegrations.WebhookEnabled {
|
||||
var webhookURL string
|
||||
if entry.Feed != nil && entry.Feed.WebhookURL != "" {
|
||||
webhookURL = entry.Feed.WebhookURL
|
||||
} else {
|
||||
webhookURL = userIntegrations.WebhookURL
|
||||
}
|
||||
|
||||
slog.Debug("Sending entry to Webhook",
|
||||
slog.Int64("user_id", userIntegrations.UserID),
|
||||
slog.Int64("entry_id", entry.ID),
|
||||
slog.String("entry_url", entry.URL),
|
||||
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.SendSaveEntryWebhookEvent(entry); err != nil {
|
||||
slog.Error("Unable to send entry to Webhook",
|
||||
slog.Int64("user_id", userIntegrations.UserID),
|
||||
slog.Int64("entry_id", entry.ID),
|
||||
slog.String("entry_url", entry.URL),
|
||||
slog.String("webhook_url", userIntegrations.WebhookURL),
|
||||
slog.String("webhook_url", webhookURL),
|
||||
slog.Any("error", err),
|
||||
)
|
||||
}
|
||||
|
|
|
@ -292,6 +292,7 @@ func (e *EntryQueryBuilder) GetEntries() (model.Entries, error) {
|
|||
f.cookie,
|
||||
f.hide_globally,
|
||||
f.no_media_player,
|
||||
f.webhook_url,
|
||||
fi.icon_id,
|
||||
i.external_id AS icon_external_id,
|
||||
u.timezone
|
||||
|
@ -364,6 +365,7 @@ func (e *EntryQueryBuilder) GetEntries() (model.Entries, error) {
|
|||
&entry.Feed.Cookie,
|
||||
&entry.Feed.HideGlobally,
|
||||
&entry.Feed.NoMediaPlayer,
|
||||
&entry.Feed.WebhookURL,
|
||||
&iconID,
|
||||
&externalIconID,
|
||||
&tz,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue