Skip to content

Commit

Permalink
Fix Apprise logic to handle feed service URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
fguillot committed Sep 30, 2023
1 parent f98fc1e commit a967027
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion internal/integration/apprise/apprise.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func NewClient(serviceURL, baseURL string) *Client {

func (c *Client) SendNotification(entry *model.Entry) error {
if c.baseURL == "" || c.servicesURL == "" {
return fmt.Errorf("apprise: missing base URL or service URL")
return fmt.Errorf("apprise: missing base URL or services URL")
}

message := "[" + entry.Title + "]" + "(" + entry.URL + ")" + "\n\n"
Expand Down
6 changes: 4 additions & 2 deletions internal/integration/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,23 +370,25 @@ func PushEntries(feed *model.Feed, entries model.Entries, userIntegrations *mode
slog.Int64("user_id", userIntegrations.UserID),
slog.Int64("entry_id", entry.ID),
slog.String("entry_url", entry.URL),
slog.String("apprise_url", userIntegrations.AppriseURL),
)

appriseServiceURLs := userIntegrations.AppriseURL
appriseServiceURLs := userIntegrations.AppriseServicesURL
if feed.AppriseServiceURLs != "" {
appriseServiceURLs = feed.AppriseServiceURLs
}

client := apprise.NewClient(
userIntegrations.AppriseServicesURL,
appriseServiceURLs,
userIntegrations.AppriseURL,
)

if err := client.SendNotification(entry); err != nil {
slog.Error("Unable to send entry to Apprise",
slog.Int64("user_id", userIntegrations.UserID),
slog.Int64("entry_id", entry.ID),
slog.String("entry_url", entry.URL),
slog.String("apprise_url", userIntegrations.AppriseURL),
slog.Any("error", err),
)
}
Expand Down

0 comments on commit a967027

Please sign in to comment.