2023-06-19 23:42:47 +02:00
|
|
|
// SPDX-FileCopyrightText: Copyright The Miniflux Authors. All rights reserved.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
2017-12-03 06:12:03 +01:00
|
|
|
|
2023-08-11 04:46:45 +02:00
|
|
|
package integration // import "miniflux.app/v2/internal/integration"
|
2017-12-03 06:12:03 +01:00
|
|
|
|
|
|
|
import (
|
2023-09-25 01:32:09 +02:00
|
|
|
"log/slog"
|
|
|
|
|
2023-08-11 04:46:45 +02:00
|
|
|
"miniflux.app/v2/internal/config"
|
|
|
|
"miniflux.app/v2/internal/integration/apprise"
|
|
|
|
"miniflux.app/v2/internal/integration/espial"
|
|
|
|
"miniflux.app/v2/internal/integration/instapaper"
|
|
|
|
"miniflux.app/v2/internal/integration/linkding"
|
|
|
|
"miniflux.app/v2/internal/integration/matrixbot"
|
|
|
|
"miniflux.app/v2/internal/integration/notion"
|
|
|
|
"miniflux.app/v2/internal/integration/nunuxkeeper"
|
|
|
|
"miniflux.app/v2/internal/integration/pinboard"
|
|
|
|
"miniflux.app/v2/internal/integration/pocket"
|
|
|
|
"miniflux.app/v2/internal/integration/readwise"
|
2023-08-13 23:30:57 +02:00
|
|
|
"miniflux.app/v2/internal/integration/shaarli"
|
2023-08-13 21:48:29 +02:00
|
|
|
"miniflux.app/v2/internal/integration/shiori"
|
2023-08-11 04:46:45 +02:00
|
|
|
"miniflux.app/v2/internal/integration/telegrambot"
|
|
|
|
"miniflux.app/v2/internal/integration/wallabag"
|
2023-09-09 07:45:17 +02:00
|
|
|
"miniflux.app/v2/internal/integration/webhook"
|
2023-08-11 04:46:45 +02:00
|
|
|
"miniflux.app/v2/internal/model"
|
2017-12-03 06:12:03 +01:00
|
|
|
)
|
|
|
|
|
2021-09-08 05:28:41 +02:00
|
|
|
// SendEntry sends the entry to third-party providers when the user click on "Save".
|
2023-09-25 01:32:09 +02:00
|
|
|
func SendEntry(entry *model.Entry, userIntegrations *model.Integration) {
|
|
|
|
if userIntegrations.PinboardEnabled {
|
|
|
|
slog.Debug("Sending entry to Pinboard",
|
|
|
|
slog.Int64("user_id", userIntegrations.UserID),
|
|
|
|
slog.Int64("entry_id", entry.ID),
|
|
|
|
slog.String("entry_url", entry.URL),
|
|
|
|
)
|
2021-09-08 05:28:41 +02:00
|
|
|
|
2023-09-25 01:32:09 +02:00
|
|
|
client := pinboard.NewClient(userIntegrations.PinboardToken)
|
2023-08-14 06:58:45 +02:00
|
|
|
err := client.CreateBookmark(
|
2017-12-19 05:52:46 +01:00
|
|
|
entry.URL,
|
|
|
|
entry.Title,
|
2023-09-25 01:32:09 +02:00
|
|
|
userIntegrations.PinboardTags,
|
|
|
|
userIntegrations.PinboardMarkAsUnread,
|
2017-12-19 05:52:46 +01:00
|
|
|
)
|
|
|
|
|
2017-12-03 06:12:03 +01:00
|
|
|
if err != nil {
|
2023-09-25 01:32:09 +02:00
|
|
|
slog.Error("Unable to send entry to Pinboard",
|
|
|
|
slog.Int64("user_id", userIntegrations.UserID),
|
|
|
|
slog.Int64("entry_id", entry.ID),
|
|
|
|
slog.String("entry_url", entry.URL),
|
|
|
|
slog.Any("error", err),
|
|
|
|
)
|
2017-12-03 06:12:03 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-09-25 01:32:09 +02:00
|
|
|
if userIntegrations.InstapaperEnabled {
|
|
|
|
slog.Debug("Sending entry to Instapaper",
|
|
|
|
slog.Int64("user_id", userIntegrations.UserID),
|
|
|
|
slog.Int64("entry_id", entry.ID),
|
|
|
|
slog.String("entry_url", entry.URL),
|
|
|
|
)
|
2021-09-08 05:28:41 +02:00
|
|
|
|
2023-09-25 01:32:09 +02:00
|
|
|
client := instapaper.NewClient(userIntegrations.InstapaperUsername, userIntegrations.InstapaperPassword)
|
2017-12-19 05:52:46 +01:00
|
|
|
if err := client.AddURL(entry.URL, entry.Title); err != nil {
|
2023-09-25 01:32:09 +02:00
|
|
|
slog.Error("Unable to send entry to Instapaper",
|
|
|
|
slog.Int64("user_id", userIntegrations.UserID),
|
|
|
|
slog.Int64("entry_id", entry.ID),
|
|
|
|
slog.String("entry_url", entry.URL),
|
|
|
|
slog.Any("error", err),
|
|
|
|
)
|
2017-12-19 05:52:46 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-09-25 01:32:09 +02:00
|
|
|
if userIntegrations.WallabagEnabled {
|
|
|
|
slog.Debug("Sending entry to Wallabag",
|
|
|
|
slog.Int64("user_id", userIntegrations.UserID),
|
|
|
|
slog.Int64("entry_id", entry.ID),
|
|
|
|
slog.String("entry_url", entry.URL),
|
|
|
|
)
|
2021-09-08 05:28:41 +02:00
|
|
|
|
2017-12-19 05:52:46 +01:00
|
|
|
client := wallabag.NewClient(
|
2023-09-25 01:32:09 +02:00
|
|
|
userIntegrations.WallabagURL,
|
|
|
|
userIntegrations.WallabagClientID,
|
|
|
|
userIntegrations.WallabagClientSecret,
|
|
|
|
userIntegrations.WallabagUsername,
|
|
|
|
userIntegrations.WallabagPassword,
|
|
|
|
userIntegrations.WallabagOnlyURL,
|
2017-12-19 05:52:46 +01:00
|
|
|
)
|
|
|
|
|
2023-08-14 06:58:45 +02:00
|
|
|
if err := client.CreateEntry(entry.URL, entry.Title, entry.Content); err != nil {
|
2023-09-25 01:32:09 +02:00
|
|
|
slog.Error("Unable to send entry to Wallabag",
|
|
|
|
slog.Int64("user_id", userIntegrations.UserID),
|
|
|
|
slog.Int64("entry_id", entry.ID),
|
|
|
|
slog.String("entry_url", entry.URL),
|
|
|
|
slog.Any("error", err),
|
|
|
|
)
|
2017-12-03 06:12:03 +01:00
|
|
|
}
|
|
|
|
}
|
2018-02-25 20:49:08 +01:00
|
|
|
|
2023-09-25 01:32:09 +02:00
|
|
|
if userIntegrations.NotionEnabled {
|
|
|
|
slog.Debug("Sending entry to Notion",
|
|
|
|
slog.Int64("user_id", userIntegrations.UserID),
|
|
|
|
slog.Int64("entry_id", entry.ID),
|
|
|
|
slog.String("entry_url", entry.URL),
|
|
|
|
)
|
2023-07-08 00:20:14 +02:00
|
|
|
|
|
|
|
client := notion.NewClient(
|
2023-09-25 01:32:09 +02:00
|
|
|
userIntegrations.NotionToken,
|
|
|
|
userIntegrations.NotionPageID,
|
2023-07-08 00:20:14 +02:00
|
|
|
)
|
2023-08-14 06:58:45 +02:00
|
|
|
if err := client.UpdateDocument(entry.URL, entry.Title); err != nil {
|
2023-09-25 01:32:09 +02:00
|
|
|
slog.Error("Unable to send entry to Notion",
|
|
|
|
slog.Int64("user_id", userIntegrations.UserID),
|
|
|
|
slog.Int64("entry_id", entry.ID),
|
|
|
|
slog.String("entry_url", entry.URL),
|
|
|
|
slog.Any("error", err),
|
|
|
|
)
|
2023-07-08 00:20:14 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-09-25 01:32:09 +02:00
|
|
|
if userIntegrations.NunuxKeeperEnabled {
|
|
|
|
slog.Debug("Sending entry to NunuxKeeper",
|
|
|
|
slog.Int64("user_id", userIntegrations.UserID),
|
|
|
|
slog.Int64("entry_id", entry.ID),
|
|
|
|
slog.String("entry_url", entry.URL),
|
|
|
|
)
|
2021-09-08 05:28:41 +02:00
|
|
|
|
2018-02-25 20:49:08 +01:00
|
|
|
client := nunuxkeeper.NewClient(
|
2023-09-25 01:32:09 +02:00
|
|
|
userIntegrations.NunuxKeeperURL,
|
|
|
|
userIntegrations.NunuxKeeperAPIKey,
|
2018-02-25 20:49:08 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
if err := client.AddEntry(entry.URL, entry.Title, entry.Content); err != nil {
|
2023-09-25 01:32:09 +02:00
|
|
|
slog.Error("Unable to send entry to NunuxKeeper",
|
|
|
|
slog.Int64("user_id", userIntegrations.UserID),
|
|
|
|
slog.Int64("entry_id", entry.ID),
|
|
|
|
slog.String("entry_url", entry.URL),
|
|
|
|
slog.Any("error", err),
|
|
|
|
)
|
2018-02-25 20:49:08 +01:00
|
|
|
}
|
|
|
|
}
|
2018-05-20 22:31:56 +02:00
|
|
|
|
2023-09-25 01:32:09 +02:00
|
|
|
if userIntegrations.EspialEnabled {
|
|
|
|
slog.Debug("Sending entry to Espial",
|
|
|
|
slog.Int64("user_id", userIntegrations.UserID),
|
|
|
|
slog.Int64("entry_id", entry.ID),
|
|
|
|
slog.String("entry_url", entry.URL),
|
|
|
|
)
|
2022-04-21 04:44:47 +02:00
|
|
|
|
|
|
|
client := espial.NewClient(
|
2023-09-25 01:32:09 +02:00
|
|
|
userIntegrations.EspialURL,
|
|
|
|
userIntegrations.EspialAPIKey,
|
2022-04-21 04:44:47 +02:00
|
|
|
)
|
|
|
|
|
2023-09-25 01:32:09 +02:00
|
|
|
if err := client.CreateLink(entry.URL, entry.Title, userIntegrations.EspialTags); err != nil {
|
|
|
|
slog.Error("Unable to send entry to Espial",
|
|
|
|
slog.Int64("user_id", userIntegrations.UserID),
|
|
|
|
slog.Int64("entry_id", entry.ID),
|
|
|
|
slog.String("entry_url", entry.URL),
|
|
|
|
slog.Any("error", err),
|
|
|
|
)
|
2022-04-21 04:44:47 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-09-25 01:32:09 +02:00
|
|
|
if userIntegrations.PocketEnabled {
|
|
|
|
slog.Debug("Sending entry to Pocket",
|
|
|
|
slog.Int64("user_id", userIntegrations.UserID),
|
|
|
|
slog.Int64("entry_id", entry.ID),
|
|
|
|
slog.String("entry_url", entry.URL),
|
|
|
|
)
|
2021-09-08 05:28:41 +02:00
|
|
|
|
2023-09-25 01:32:09 +02:00
|
|
|
client := pocket.NewClient(config.Opts.PocketConsumerKey(userIntegrations.PocketConsumerKey), userIntegrations.PocketAccessToken)
|
2018-05-20 22:31:56 +02:00
|
|
|
if err := client.AddURL(entry.URL, entry.Title); err != nil {
|
2023-09-25 01:32:09 +02:00
|
|
|
slog.Error("Unable to send entry to Pocket",
|
|
|
|
slog.Int64("user_id", userIntegrations.UserID),
|
|
|
|
slog.Int64("entry_id", entry.ID),
|
|
|
|
slog.String("entry_url", entry.URL),
|
|
|
|
slog.Any("error", err),
|
|
|
|
)
|
2018-05-20 22:31:56 +02:00
|
|
|
}
|
|
|
|
}
|
2022-05-23 17:53:06 +02:00
|
|
|
|
2023-09-25 01:32:09 +02:00
|
|
|
if userIntegrations.LinkdingEnabled {
|
|
|
|
slog.Debug("Sending entry to Linkding",
|
|
|
|
slog.Int64("user_id", userIntegrations.UserID),
|
|
|
|
slog.Int64("entry_id", entry.ID),
|
|
|
|
slog.String("entry_url", entry.URL),
|
|
|
|
)
|
2022-05-23 17:53:06 +02:00
|
|
|
|
|
|
|
client := linkding.NewClient(
|
2023-09-25 01:32:09 +02:00
|
|
|
userIntegrations.LinkdingURL,
|
|
|
|
userIntegrations.LinkdingAPIKey,
|
|
|
|
userIntegrations.LinkdingTags,
|
|
|
|
userIntegrations.LinkdingMarkAsUnread,
|
2022-05-23 17:53:06 +02:00
|
|
|
)
|
2023-08-14 06:58:45 +02:00
|
|
|
if err := client.CreateBookmark(entry.URL, entry.Title); err != nil {
|
2023-09-25 01:32:09 +02:00
|
|
|
slog.Error("Unable to send entry to Linkding",
|
|
|
|
slog.Int64("user_id", userIntegrations.UserID),
|
|
|
|
slog.Int64("entry_id", entry.ID),
|
|
|
|
slog.String("entry_url", entry.URL),
|
|
|
|
slog.Any("error", err),
|
|
|
|
)
|
2022-05-23 17:53:06 +02:00
|
|
|
}
|
|
|
|
}
|
2023-07-28 05:51:44 +02:00
|
|
|
|
2023-09-25 01:32:09 +02:00
|
|
|
if userIntegrations.ReadwiseEnabled {
|
|
|
|
slog.Debug("Sending entry to Readwise",
|
|
|
|
slog.Int64("user_id", userIntegrations.UserID),
|
|
|
|
slog.Int64("entry_id", entry.ID),
|
|
|
|
slog.String("entry_url", entry.URL),
|
|
|
|
)
|
2023-07-28 05:51:44 +02:00
|
|
|
|
|
|
|
client := readwise.NewClient(
|
2023-09-25 01:32:09 +02:00
|
|
|
userIntegrations.ReadwiseAPIKey,
|
2023-07-28 05:51:44 +02:00
|
|
|
)
|
|
|
|
|
2023-08-14 06:58:45 +02:00
|
|
|
if err := client.CreateDocument(entry.URL); err != nil {
|
2023-09-25 01:32:09 +02:00
|
|
|
slog.Error("Unable to send entry to Readwise",
|
|
|
|
slog.Int64("user_id", userIntegrations.UserID),
|
|
|
|
slog.Int64("entry_id", entry.ID),
|
|
|
|
slog.String("entry_url", entry.URL),
|
|
|
|
slog.Any("error", err),
|
|
|
|
)
|
2023-07-28 05:51:44 +02:00
|
|
|
}
|
|
|
|
}
|
2023-08-13 21:48:29 +02:00
|
|
|
|
2023-09-25 01:32:09 +02:00
|
|
|
if userIntegrations.ShioriEnabled {
|
|
|
|
slog.Debug("Sending entry to Shiori",
|
|
|
|
slog.Int64("user_id", userIntegrations.UserID),
|
|
|
|
slog.Int64("entry_id", entry.ID),
|
|
|
|
slog.String("entry_url", entry.URL),
|
|
|
|
)
|
2023-08-13 21:48:29 +02:00
|
|
|
|
|
|
|
client := shiori.NewClient(
|
2023-09-25 01:32:09 +02:00
|
|
|
userIntegrations.ShioriURL,
|
|
|
|
userIntegrations.ShioriUsername,
|
|
|
|
userIntegrations.ShioriPassword,
|
2023-08-13 21:48:29 +02:00
|
|
|
)
|
|
|
|
|
2023-08-14 06:58:45 +02:00
|
|
|
if err := client.CreateBookmark(entry.URL, entry.Title); err != nil {
|
2023-09-25 01:32:09 +02:00
|
|
|
slog.Error("Unable to send entry to Shiori",
|
|
|
|
slog.Int64("user_id", userIntegrations.UserID),
|
|
|
|
slog.Int64("entry_id", entry.ID),
|
|
|
|
slog.String("entry_url", entry.URL),
|
|
|
|
slog.Any("error", err),
|
|
|
|
)
|
2023-08-13 21:48:29 +02:00
|
|
|
}
|
|
|
|
}
|
2023-08-13 23:30:57 +02:00
|
|
|
|
2023-09-25 01:32:09 +02:00
|
|
|
if userIntegrations.ShaarliEnabled {
|
|
|
|
slog.Debug("Sending entry to Shaarli",
|
|
|
|
slog.Int64("user_id", userIntegrations.UserID),
|
|
|
|
slog.Int64("entry_id", entry.ID),
|
|
|
|
slog.String("entry_url", entry.URL),
|
|
|
|
)
|
2023-08-13 23:30:57 +02:00
|
|
|
|
|
|
|
client := shaarli.NewClient(
|
2023-09-25 01:32:09 +02:00
|
|
|
userIntegrations.ShaarliURL,
|
|
|
|
userIntegrations.ShaarliAPISecret,
|
2023-08-13 23:30:57 +02:00
|
|
|
)
|
|
|
|
|
2023-08-14 06:58:45 +02:00
|
|
|
if err := client.CreateLink(entry.URL, entry.Title); err != nil {
|
2023-09-25 01:32:09 +02:00
|
|
|
slog.Error("Unable to send entry to Shaarli",
|
|
|
|
slog.Int64("user_id", userIntegrations.UserID),
|
|
|
|
slog.Int64("entry_id", entry.ID),
|
|
|
|
slog.String("entry_url", entry.URL),
|
|
|
|
slog.Any("error", err),
|
|
|
|
)
|
2023-08-13 23:30:57 +02:00
|
|
|
}
|
|
|
|
}
|
2023-09-11 02:47:05 +02:00
|
|
|
|
2023-09-25 01:32:09 +02:00
|
|
|
if userIntegrations.WebhookEnabled {
|
|
|
|
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),
|
|
|
|
)
|
2023-09-11 02:47:05 +02:00
|
|
|
|
2023-09-25 01:32:09 +02:00
|
|
|
webhookClient := webhook.NewClient(userIntegrations.WebhookURL, userIntegrations.WebhookSecret)
|
2023-09-11 02:47:05 +02:00
|
|
|
if err := webhookClient.SendSaveEntryWebhookEvent(entry); err != nil {
|
2023-09-25 01:32:09 +02:00
|
|
|
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.Any("error", err),
|
|
|
|
)
|
2023-09-11 02:47:05 +02:00
|
|
|
}
|
|
|
|
}
|
2017-12-03 06:12:03 +01:00
|
|
|
}
|
2021-09-08 05:04:22 +02:00
|
|
|
|
2023-09-09 07:45:17 +02:00
|
|
|
// PushEntries pushes a list of entries to activated third-party providers during feed refreshes.
|
|
|
|
func PushEntries(feed *model.Feed, entries model.Entries, userIntegrations *model.Integration) {
|
|
|
|
if userIntegrations.MatrixBotEnabled {
|
2023-09-25 01:32:09 +02:00
|
|
|
slog.Debug("Sending new entries to Matrix",
|
|
|
|
slog.Int64("user_id", userIntegrations.UserID),
|
|
|
|
slog.Int("nb_entries", len(entries)),
|
|
|
|
slog.Int64("feed_id", feed.ID),
|
|
|
|
)
|
2022-10-14 17:18:44 +02:00
|
|
|
|
2023-09-25 01:32:09 +02:00
|
|
|
err := matrixbot.PushEntries(
|
|
|
|
feed,
|
|
|
|
entries,
|
|
|
|
userIntegrations.MatrixBotURL,
|
|
|
|
userIntegrations.MatrixBotUser,
|
|
|
|
userIntegrations.MatrixBotPassword,
|
|
|
|
userIntegrations.MatrixBotChatID,
|
|
|
|
)
|
2022-10-14 17:18:44 +02:00
|
|
|
if err != nil {
|
2023-09-25 01:32:09 +02:00
|
|
|
slog.Error("Unable to send new entries to Matrix",
|
|
|
|
slog.Int64("user_id", userIntegrations.UserID),
|
|
|
|
slog.Int("nb_entries", len(entries)),
|
|
|
|
slog.Int64("feed_id", feed.ID),
|
|
|
|
slog.Any("error", err),
|
|
|
|
)
|
2022-10-14 17:18:44 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-09-09 07:45:17 +02:00
|
|
|
if userIntegrations.WebhookEnabled {
|
2023-09-25 01:32:09 +02:00
|
|
|
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),
|
|
|
|
)
|
2021-09-08 05:28:41 +02:00
|
|
|
|
2023-09-09 07:45:17 +02:00
|
|
|
webhookClient := webhook.NewClient(userIntegrations.WebhookURL, userIntegrations.WebhookSecret)
|
2023-09-11 02:47:05 +02:00
|
|
|
if err := webhookClient.SendNewEntriesWebhookEvent(feed, entries); err != nil {
|
2023-09-25 01:32:09 +02:00
|
|
|
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.Any("error", err),
|
|
|
|
)
|
2021-09-08 05:04:22 +02:00
|
|
|
}
|
|
|
|
}
|
2023-08-14 06:58:45 +02:00
|
|
|
|
2023-09-09 07:45:17 +02:00
|
|
|
// Integrations that only support sending individual entries
|
|
|
|
if userIntegrations.TelegramBotEnabled || userIntegrations.AppriseEnabled {
|
|
|
|
for _, entry := range entries {
|
|
|
|
if userIntegrations.TelegramBotEnabled {
|
2023-09-25 01:32:09 +02:00
|
|
|
slog.Debug("Sending a new entry to Telegram",
|
|
|
|
slog.Int64("user_id", userIntegrations.UserID),
|
|
|
|
slog.Int64("entry_id", entry.ID),
|
|
|
|
slog.String("entry_url", entry.URL),
|
|
|
|
)
|
2023-09-10 20:22:32 +02:00
|
|
|
|
|
|
|
if err := telegrambot.PushEntry(
|
|
|
|
feed,
|
|
|
|
entry,
|
|
|
|
userIntegrations.TelegramBotToken,
|
|
|
|
userIntegrations.TelegramBotChatID,
|
|
|
|
userIntegrations.TelegramBotTopicID,
|
|
|
|
userIntegrations.TelegramBotDisableWebPagePreview,
|
|
|
|
userIntegrations.TelegramBotDisableNotification,
|
2023-09-28 05:02:22 +02:00
|
|
|
userIntegrations.TelegramBotDisableButtons,
|
2023-09-10 20:22:32 +02:00
|
|
|
); err != nil {
|
2023-09-25 01:32:09 +02:00
|
|
|
slog.Error("Unable to send entry to Telegram",
|
|
|
|
slog.Int64("user_id", userIntegrations.UserID),
|
|
|
|
slog.Int64("entry_id", entry.ID),
|
|
|
|
slog.String("entry_url", entry.URL),
|
|
|
|
slog.Any("error", err),
|
|
|
|
)
|
2023-09-09 07:45:17 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if userIntegrations.AppriseEnabled {
|
2023-09-25 01:32:09 +02:00
|
|
|
slog.Debug("Sending a new entry to Apprise",
|
|
|
|
slog.Int64("user_id", userIntegrations.UserID),
|
|
|
|
slog.Int64("entry_id", entry.ID),
|
|
|
|
slog.String("entry_url", entry.URL),
|
2023-09-30 23:55:33 +02:00
|
|
|
slog.String("apprise_url", userIntegrations.AppriseURL),
|
2023-09-25 01:32:09 +02:00
|
|
|
)
|
2023-09-09 07:45:17 +02:00
|
|
|
|
2023-09-30 23:55:33 +02:00
|
|
|
appriseServiceURLs := userIntegrations.AppriseServicesURL
|
2023-09-09 07:45:17 +02:00
|
|
|
if feed.AppriseServiceURLs != "" {
|
|
|
|
appriseServiceURLs = feed.AppriseServiceURLs
|
|
|
|
}
|
|
|
|
|
|
|
|
client := apprise.NewClient(
|
|
|
|
appriseServiceURLs,
|
2023-09-30 23:55:33 +02:00
|
|
|
userIntegrations.AppriseURL,
|
2023-09-09 07:45:17 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
if err := client.SendNotification(entry); err != nil {
|
2023-09-25 01:32:09 +02:00
|
|
|
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),
|
2023-09-30 23:55:33 +02:00
|
|
|
slog.String("apprise_url", userIntegrations.AppriseURL),
|
2023-09-25 01:32:09 +02:00
|
|
|
slog.Any("error", err),
|
|
|
|
)
|
2023-09-09 07:45:17 +02:00
|
|
|
}
|
|
|
|
}
|
2023-08-01 05:55:17 +02:00
|
|
|
}
|
|
|
|
}
|
2021-09-08 05:04:22 +02:00
|
|
|
}
|