|
|
@@ -16,9 +16,11 @@ import (
|
|
|
"miniflux.app/model"
|
|
|
)
|
|
|
|
|
|
-// SendEntry send the entry to the activated providers.
|
|
|
+// SendEntry sends the entry to third-party providers when the user click on "Save".
|
|
|
func SendEntry(entry *model.Entry, integration *model.Integration) {
|
|
|
if integration.PinboardEnabled {
|
|
|
+ logger.Debug("[Integration] Sending Entry #%d %q for User #%d to Pinboard", entry.ID, entry.URL, integration.UserID)
|
|
|
+
|
|
|
client := pinboard.NewClient(integration.PinboardToken)
|
|
|
err := client.AddBookmark(
|
|
|
entry.URL,
|
|
|
@@ -33,6 +35,8 @@ func SendEntry(entry *model.Entry, integration *model.Integration) {
|
|
|
}
|
|
|
|
|
|
if integration.InstapaperEnabled {
|
|
|
+ logger.Debug("[Integration] Sending Entry #%d %q for User #%d to Instapaper", entry.ID, entry.URL, integration.UserID)
|
|
|
+
|
|
|
client := instapaper.NewClient(integration.InstapaperUsername, integration.InstapaperPassword)
|
|
|
if err := client.AddURL(entry.URL, entry.Title); err != nil {
|
|
|
logger.Error("[Integration] UserID #%d: %v", integration.UserID, err)
|
|
|
@@ -40,6 +44,8 @@ func SendEntry(entry *model.Entry, integration *model.Integration) {
|
|
|
}
|
|
|
|
|
|
if integration.WallabagEnabled {
|
|
|
+ logger.Debug("[Integration] Sending Entry #%d %q for User #%d to Wallabag", entry.ID, entry.URL, integration.UserID)
|
|
|
+
|
|
|
client := wallabag.NewClient(
|
|
|
integration.WallabagURL,
|
|
|
integration.WallabagClientID,
|
|
|
@@ -54,6 +60,8 @@ func SendEntry(entry *model.Entry, integration *model.Integration) {
|
|
|
}
|
|
|
|
|
|
if integration.NunuxKeeperEnabled {
|
|
|
+ logger.Debug("[Integration] Sending Entry #%d %q for User #%d to NunuxKeeper", entry.ID, entry.URL, integration.UserID)
|
|
|
+
|
|
|
client := nunuxkeeper.NewClient(
|
|
|
integration.NunuxKeeperURL,
|
|
|
integration.NunuxKeeperAPIKey,
|
|
|
@@ -65,6 +73,8 @@ func SendEntry(entry *model.Entry, integration *model.Integration) {
|
|
|
}
|
|
|
|
|
|
if integration.PocketEnabled {
|
|
|
+ logger.Debug("[Integration] Sending Entry #%d %q for User #%d to Pocket", entry.ID, entry.URL, integration.UserID)
|
|
|
+
|
|
|
client := pocket.NewClient(config.Opts.PocketConsumerKey(integration.PocketConsumerKey), integration.PocketAccessToken)
|
|
|
if err := client.AddURL(entry.URL, entry.Title); err != nil {
|
|
|
logger.Error("[Integration] UserID #%d: %v", integration.UserID, err)
|
|
|
@@ -72,11 +82,11 @@ func SendEntry(entry *model.Entry, integration *model.Integration) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// PushEntry pushes new entry to the activated providers.
|
|
|
-// This function should be wrapped in a goroutine to avoid block of program execution.
|
|
|
+// PushEntry pushes an entry to third-party providers during feed refreshes.
|
|
|
func PushEntry(entry *model.Entry, integration *model.Integration) {
|
|
|
if integration.TelegramBotEnabled {
|
|
|
- logger.Debug("[Integration] Sending Entry #%d for User #%d to telegram", entry.ID, integration.UserID)
|
|
|
+ logger.Debug("[Integration] Sending Entry %q for User #%d to Telegram", entry.URL, integration.UserID)
|
|
|
+
|
|
|
err := telegrambot.PushEntry(entry, integration.TelegramBotToken, integration.TelegramBotChatID)
|
|
|
if err != nil {
|
|
|
logger.Error("[Integration] push entry to telegram bot failed: %v", err)
|