diff --git a/internal/database/migrations.go b/internal/database/migrations.go index bcd7e494..bdd6f739 100644 --- a/internal/database/migrations.go +++ b/internal/database/migrations.go @@ -776,4 +776,11 @@ var migrations = []func(tx *sql.Tx) error{ _, err = tx.Exec(sql) return err }, + func(tx *sql.Tx) (err error) { + sql := ` + ALTER TABLE integrations ADD COLUMN telegram_bot_disable_buttons bool default 'f'; + ` + _, err = tx.Exec(sql) + return err + }, } diff --git a/internal/integration/integration.go b/internal/integration/integration.go index 7d71844c..2c8eeed6 100644 --- a/internal/integration/integration.go +++ b/internal/integration/integration.go @@ -354,6 +354,7 @@ func PushEntries(feed *model.Feed, entries model.Entries, userIntegrations *mode userIntegrations.TelegramBotTopicID, userIntegrations.TelegramBotDisableWebPagePreview, userIntegrations.TelegramBotDisableNotification, + userIntegrations.TelegramBotDisableButtons, ); err != nil { slog.Error("Unable to send entry to Telegram", slog.Int64("user_id", userIntegrations.UserID), diff --git a/internal/integration/telegrambot/telegrambot.go b/internal/integration/telegrambot/telegrambot.go index b6097b2b..b73b78ae 100644 --- a/internal/integration/telegrambot/telegrambot.go +++ b/internal/integration/telegrambot/telegrambot.go @@ -9,7 +9,7 @@ import ( "miniflux.app/v2/internal/model" ) -func PushEntry(feed *model.Feed, entry *model.Entry, botToken, chatID string, topicID *int64, disableWebPagePreview, disableNotification bool) error { +func PushEntry(feed *model.Feed, entry *model.Entry, botToken, chatID string, topicID *int64, disableWebPagePreview, disableNotification bool, disableButtons bool) error { textTemplate := `%s - %s` formattedText := fmt.Sprintf( textTemplate, @@ -31,19 +31,21 @@ func PushEntry(feed *model.Feed, entry *model.Entry, botToken, chatID string, to message.MessageThreadID = *topicID } - var markupRow []*InlineKeyboardButton + if !disableButtons { + var markupRow []*InlineKeyboardButton - minifluxURLButton := InlineKeyboardButton{Text: "Go to article", URL: entry.URL} - markupRow = append(markupRow, &minifluxURLButton) + minifluxURLButton := InlineKeyboardButton{Text: "Go to article", URL: entry.URL} + markupRow = append(markupRow, &minifluxURLButton) - if entry.CommentsURL != "" { - commentButton := InlineKeyboardButton{Text: "Comments", URL: entry.CommentsURL} - markupRow = append(markupRow, &commentButton) + if entry.CommentsURL != "" { + commentButton := InlineKeyboardButton{Text: "Comments", URL: entry.CommentsURL} + markupRow = append(markupRow, &commentButton) + } + + message.ReplyMarkup = &InlineKeyboard{} + message.ReplyMarkup.InlineKeyboard = append(message.ReplyMarkup.InlineKeyboard, markupRow) } - message.ReplyMarkup = &InlineKeyboard{} - message.ReplyMarkup.InlineKeyboard = append(message.ReplyMarkup.InlineKeyboard, markupRow) - client := NewClient(botToken, chatID) _, err := client.SendMessage(message) return err diff --git a/internal/locale/translations/de_DE.json b/internal/locale/translations/de_DE.json index 82638414..ef3b201d 100644 --- a/internal/locale/translations/de_DE.json +++ b/internal/locale/translations/de_DE.json @@ -382,6 +382,7 @@ "form.integration.telegram_topic_id": "Topic ID", "form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview", "form.integration.telegram_bot_disable_notification": "Disable notification", + "form.integration.telegram_bot_disable_buttons": "Disable buttons", "form.integration.linkding_activate": "Artikel in Linkding speichern", "form.integration.linkding_endpoint": "Linkding API-Endpunkt", "form.integration.linkding_api_key": "Linkding API-Schlüssel", diff --git a/internal/locale/translations/el_EL.json b/internal/locale/translations/el_EL.json index fe85fbf7..6ee849f5 100644 --- a/internal/locale/translations/el_EL.json +++ b/internal/locale/translations/el_EL.json @@ -382,6 +382,7 @@ "form.integration.telegram_topic_id": "Topic ID", "form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview", "form.integration.telegram_bot_disable_notification": "Disable notification", + "form.integration.telegram_bot_disable_buttons": "Disable buttons", "form.integration.linkding_activate": "Αποθήκευση άρθρων στο Linkding", "form.integration.linkding_endpoint": "Τελικό σημείο Linkding API", "form.integration.linkding_api_key": "Κλειδί API Linkding", diff --git a/internal/locale/translations/en_US.json b/internal/locale/translations/en_US.json index 5104f7ee..0ac44b48 100644 --- a/internal/locale/translations/en_US.json +++ b/internal/locale/translations/en_US.json @@ -382,6 +382,7 @@ "form.integration.telegram_topic_id": "Topic ID", "form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview", "form.integration.telegram_bot_disable_notification": "Disable notification", + "form.integration.telegram_bot_disable_buttons": "Disable buttons", "form.integration.linkding_activate": "Save entries to Linkding", "form.integration.linkding_endpoint": "Linkding API Endpoint", "form.integration.linkding_api_key": "Linkding API key", diff --git a/internal/locale/translations/es_ES.json b/internal/locale/translations/es_ES.json index 21f6d0e2..596b966a 100644 --- a/internal/locale/translations/es_ES.json +++ b/internal/locale/translations/es_ES.json @@ -382,6 +382,7 @@ "form.integration.telegram_topic_id": "Topic ID", "form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview", "form.integration.telegram_bot_disable_notification": "Disable notification", + "form.integration.telegram_bot_disable_buttons": "Disable buttons", "form.integration.linkding_activate": "Enviar artículos a Linkding", "form.integration.linkding_endpoint": "Acceso API de Linkding", "form.integration.linkding_api_key": "Clave de API de Linkding", diff --git a/internal/locale/translations/fi_FI.json b/internal/locale/translations/fi_FI.json index 1330f274..07573a06 100644 --- a/internal/locale/translations/fi_FI.json +++ b/internal/locale/translations/fi_FI.json @@ -382,6 +382,7 @@ "form.integration.telegram_topic_id": "Topic ID", "form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview", "form.integration.telegram_bot_disable_notification": "Disable notification", + "form.integration.telegram_bot_disable_buttons": "Disable buttons", "form.integration.linkding_activate": "Tallenna artikkelit Linkkiin", "form.integration.linkding_endpoint": "Linkding API-päätepiste", "form.integration.linkding_api_key": "Linkding API-avain", diff --git a/internal/locale/translations/fr_FR.json b/internal/locale/translations/fr_FR.json index 824f0ff2..9ef51950 100644 --- a/internal/locale/translations/fr_FR.json +++ b/internal/locale/translations/fr_FR.json @@ -382,6 +382,7 @@ "form.integration.telegram_topic_id": "Identifiant du sujet (Topic ID)", "form.integration.telegram_bot_disable_web_page_preview": "Désactiver l'aperçu de la page Web", "form.integration.telegram_bot_disable_notification": "Désactiver les notifications", + "form.integration.telegram_bot_disable_buttons": "Disable buttons", "form.integration.linkding_activate": "Sauvegarder les articles vers Linkding", "form.integration.linkding_endpoint": "URL de l'API de Linkding", "form.integration.linkding_api_key": "Clé d'API de Linkding", diff --git a/internal/locale/translations/hi_IN.json b/internal/locale/translations/hi_IN.json index ddeb12c9..3e63153b 100644 --- a/internal/locale/translations/hi_IN.json +++ b/internal/locale/translations/hi_IN.json @@ -382,6 +382,7 @@ "form.integration.telegram_topic_id": "Topic ID", "form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview", "form.integration.telegram_bot_disable_notification": "Disable notification", + "form.integration.telegram_bot_disable_buttons": "Disable buttons", "form.integration.linkding_activate": "लिंक्डिन में विषयवस्तु सहेजें", "form.integration.linkding_endpoint": "लिंकिंग एपीआई समापन बिंदु", "form.integration.linkding_api_key": "लिंकिंग एपीआई कुंजी", diff --git a/internal/locale/translations/id_ID.json b/internal/locale/translations/id_ID.json index 69df8a5b..5bc3f575 100644 --- a/internal/locale/translations/id_ID.json +++ b/internal/locale/translations/id_ID.json @@ -379,6 +379,7 @@ "form.integration.telegram_topic_id": "Topic ID", "form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview", "form.integration.telegram_bot_disable_notification": "Disable notification", + "form.integration.telegram_bot_disable_buttons": "Disable buttons", "form.integration.linkding_activate": "Simpan artikel ke Linkding", "form.integration.linkding_endpoint": "Titik URL API Linkding", "form.integration.linkding_api_key": "Kunci API Linkding", diff --git a/internal/locale/translations/it_IT.json b/internal/locale/translations/it_IT.json index 3190ee60..205b4dd7 100644 --- a/internal/locale/translations/it_IT.json +++ b/internal/locale/translations/it_IT.json @@ -382,6 +382,7 @@ "form.integration.telegram_topic_id": "Topic ID", "form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview", "form.integration.telegram_bot_disable_notification": "Disable notification", + "form.integration.telegram_bot_disable_buttons": "Disable buttons", "form.integration.linkding_activate": "Salva gli articoli su Linkding", "form.integration.linkding_endpoint": "Endpoint dell'API di Linkding", "form.integration.linkding_api_key": "API key dell'account Linkding", diff --git a/internal/locale/translations/ja_JP.json b/internal/locale/translations/ja_JP.json index 869cefdf..9fee440e 100644 --- a/internal/locale/translations/ja_JP.json +++ b/internal/locale/translations/ja_JP.json @@ -382,6 +382,7 @@ "form.integration.telegram_topic_id": "Topic ID", "form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview", "form.integration.telegram_bot_disable_notification": "Disable notification", + "form.integration.telegram_bot_disable_buttons": "Disable buttons", "form.integration.linkding_activate": "Linkding に記事を保存する", "form.integration.linkding_endpoint": "Linkding の API Endpoint", "form.integration.linkding_api_key": "Linkding の API key", diff --git a/internal/locale/translations/nl_NL.json b/internal/locale/translations/nl_NL.json index b9fb357a..cd7795d5 100644 --- a/internal/locale/translations/nl_NL.json +++ b/internal/locale/translations/nl_NL.json @@ -382,6 +382,7 @@ "form.integration.telegram_topic_id": "Topic ID", "form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview", "form.integration.telegram_bot_disable_notification": "Disable notification", + "form.integration.telegram_bot_disable_buttons": "Disable buttons", "form.integration.linkding_activate": "Opslaan naar Linkding", "form.integration.linkding_endpoint": "Linkding URL", "form.integration.linkding_api_key": "Linkding API-sleutel", diff --git a/internal/locale/translations/pl_PL.json b/internal/locale/translations/pl_PL.json index ec3aaa5a..cfb032ce 100644 --- a/internal/locale/translations/pl_PL.json +++ b/internal/locale/translations/pl_PL.json @@ -384,6 +384,7 @@ "form.integration.telegram_topic_id": "Topic ID", "form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview", "form.integration.telegram_bot_disable_notification": "Disable notification", + "form.integration.telegram_bot_disable_buttons": "Disable buttons", "form.integration.linkding_activate": "Zapisz artykuły do Linkding", "form.integration.linkding_endpoint": "Linkding URL", "form.integration.linkding_api_key": "Linkding API key", diff --git a/internal/locale/translations/pt_BR.json b/internal/locale/translations/pt_BR.json index 394d6588..fc53b8dc 100644 --- a/internal/locale/translations/pt_BR.json +++ b/internal/locale/translations/pt_BR.json @@ -382,6 +382,7 @@ "form.integration.telegram_topic_id": "Topic ID", "form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview", "form.integration.telegram_bot_disable_notification": "Disable notification", + "form.integration.telegram_bot_disable_buttons": "Disable buttons", "form.integration.linkding_activate": "Salvar itens no Linkding", "form.integration.linkding_endpoint": "Endpoint de API do Linkding", "form.integration.linkding_api_key": "Chave de API do Linkding", diff --git a/internal/locale/translations/ru_RU.json b/internal/locale/translations/ru_RU.json index c59620ae..d7131ab7 100644 --- a/internal/locale/translations/ru_RU.json +++ b/internal/locale/translations/ru_RU.json @@ -384,6 +384,7 @@ "form.integration.telegram_topic_id": "Topic ID", "form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview", "form.integration.telegram_bot_disable_notification": "Disable notification", + "form.integration.telegram_bot_disable_buttons": "Disable buttons", "form.integration.linkding_activate": "Сохранять статьи в Linkding", "form.integration.linkding_endpoint": "Конечная точка Linkding API", "form.integration.linkding_api_key": "API-ключ Linkding", diff --git a/internal/locale/translations/tr_TR.json b/internal/locale/translations/tr_TR.json index d3f1d887..630879cd 100644 --- a/internal/locale/translations/tr_TR.json +++ b/internal/locale/translations/tr_TR.json @@ -382,6 +382,7 @@ "form.integration.telegram_topic_id": "Topic ID", "form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview", "form.integration.telegram_bot_disable_notification": "Disable notification", + "form.integration.telegram_bot_disable_buttons": "Disable buttons", "form.integration.linkding_activate": "Makaleleri Linkding'e kaydet", "form.integration.linkding_endpoint": "Linkding API Uç Noktası", "form.integration.linkding_api_key": "Linkding API Anahtarı", diff --git a/internal/locale/translations/uk_UA.json b/internal/locale/translations/uk_UA.json index d9b8a0eb..74ce6aec 100644 --- a/internal/locale/translations/uk_UA.json +++ b/internal/locale/translations/uk_UA.json @@ -384,6 +384,7 @@ "form.integration.telegram_topic_id": "Topic ID", "form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview", "form.integration.telegram_bot_disable_notification": "Disable notification", + "form.integration.telegram_bot_disable_buttons": "Disable buttons", "form.integration.telegram_chat_id": "ID чату", "form.integration.linkding_activate": "Зберігати статті до Linkding", "form.integration.linkding_endpoint": "Linkding API Endpoint", @@ -441,4 +442,4 @@ "%d роки тому", "%d років тому" ] -} \ No newline at end of file +} diff --git a/internal/locale/translations/zh_CN.json b/internal/locale/translations/zh_CN.json index dcd55c0d..efc6e677 100644 --- a/internal/locale/translations/zh_CN.json +++ b/internal/locale/translations/zh_CN.json @@ -379,6 +379,7 @@ "form.integration.telegram_topic_id": "Topic ID", "form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview", "form.integration.telegram_bot_disable_notification": "Disable notification", + "form.integration.telegram_bot_disable_buttons": "Disable buttons", "form.integration.telegram_chat_id": "聊天ID", "form.integration.linkding_activate": "保存文章到 Linkding", "form.integration.linkding_endpoint": "Linkding API 端点", diff --git a/internal/locale/translations/zh_TW.json b/internal/locale/translations/zh_TW.json index 9f5e4d30..805b76c1 100644 --- a/internal/locale/translations/zh_TW.json +++ b/internal/locale/translations/zh_TW.json @@ -382,6 +382,7 @@ "form.integration.telegram_topic_id": "Topic ID", "form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview", "form.integration.telegram_bot_disable_notification": "Disable notification", + "form.integration.telegram_bot_disable_buttons": "Disable buttons", "form.integration.linkding_activate": "儲存文章到 Linkding", "form.integration.linkding_endpoint": "Linkding API 端點", "form.integration.linkding_api_key": "Linkding API 金鑰", diff --git a/internal/model/integration.go b/internal/model/integration.go index 099c4b2e..49b6be07 100644 --- a/internal/model/integration.go +++ b/internal/model/integration.go @@ -47,6 +47,7 @@ type Integration struct { TelegramBotTopicID *int64 TelegramBotDisableWebPagePreview bool TelegramBotDisableNotification bool + TelegramBotDisableButtons bool LinkdingEnabled bool LinkdingURL string LinkdingAPIKey string diff --git a/internal/storage/integration.go b/internal/storage/integration.go index 8f2587c2..7cc3706c 100644 --- a/internal/storage/integration.go +++ b/internal/storage/integration.go @@ -151,6 +151,7 @@ func (s *Storage) Integration(userID int64) (*model.Integration, error) { telegram_bot_topic_id, telegram_bot_disable_web_page_preview, telegram_bot_disable_notification, + telegram_bot_disable_buttons, linkding_enabled, linkding_url, linkding_api_key, @@ -223,6 +224,7 @@ func (s *Storage) Integration(userID int64) (*model.Integration, error) { &integration.TelegramBotTopicID, &integration.TelegramBotDisableWebPagePreview, &integration.TelegramBotDisableNotification, + &integration.TelegramBotDisableButtons, &integration.LinkdingEnabled, &integration.LinkdingURL, &integration.LinkdingAPIKey, @@ -295,40 +297,41 @@ func (s *Storage) UpdateIntegration(integration *model.Integration) error { telegram_bot_topic_id=$30, telegram_bot_disable_web_page_preview=$31, telegram_bot_disable_notification=$32, - espial_enabled=$33, - espial_url=$34, - espial_api_key=$35, - espial_tags=$36, - linkding_enabled=$37, - linkding_url=$38, - linkding_api_key=$39, - linkding_tags=$40, - linkding_mark_as_unread=$41, - matrix_bot_enabled=$42, - matrix_bot_user=$43, - matrix_bot_password=$44, - matrix_bot_url=$45, - matrix_bot_chat_id=$46, - notion_enabled=$47, - notion_token=$48, - notion_page_id=$49, - readwise_enabled=$50, - readwise_api_key=$51, - apprise_enabled=$52, - apprise_url=$53, - apprise_services_url=$54, - shiori_enabled=$55, - shiori_url=$56, - shiori_username=$57, - shiori_password=$58, - shaarli_enabled=$59, - shaarli_url=$60, - shaarli_api_secret=$61, - webhook_enabled=$62, - webhook_url=$63, - webhook_secret=$64 + telegram_bot_disable_buttons=$33, + espial_enabled=$34, + espial_url=$35, + espial_api_key=$36, + espial_tags=$37, + linkding_enabled=$38, + linkding_url=$39, + linkding_api_key=$40, + linkding_tags=$41, + linkding_mark_as_unread=$42, + matrix_bot_enabled=$43, + matrix_bot_user=$44, + matrix_bot_password=$45, + matrix_bot_url=$46, + matrix_bot_chat_id=$47, + notion_enabled=$48, + notion_token=$49, + notion_page_id=$50, + readwise_enabled=$51, + readwise_api_key=$52, + apprise_enabled=$53, + apprise_url=$54, + apprise_services_url=$55, + shiori_enabled=$56, + shiori_url=$57, + shiori_username=$58, + shiori_password=$59, + shaarli_enabled=$60, + shaarli_url=$61, + shaarli_api_secret=$62, + webhook_enabled=$63, + webhook_url=$64, + webhook_secret=$65 WHERE - user_id=$65 + user_id=$66 ` _, err := s.db.Exec( query, @@ -364,6 +367,7 @@ func (s *Storage) UpdateIntegration(integration *model.Integration) error { integration.TelegramBotTopicID, integration.TelegramBotDisableWebPagePreview, integration.TelegramBotDisableNotification, + integration.TelegramBotDisableButtons, integration.EspialEnabled, integration.EspialURL, integration.EspialAPIKey, diff --git a/internal/template/templates/views/integrations.html b/internal/template/templates/views/integrations.html index 7010dc58..761cec17 100644 --- a/internal/template/templates/views/integrations.html +++ b/internal/template/templates/views/integrations.html @@ -339,6 +339,10 @@ {{ t "form.integration.telegram_bot_disable_notification" }} + +
diff --git a/internal/ui/form/integration.go b/internal/ui/form/integration.go index 9484f122..0d6b4e19 100644 --- a/internal/ui/form/integration.go +++ b/internal/ui/form/integration.go @@ -53,6 +53,7 @@ type IntegrationForm struct { TelegramBotTopicID *int64 TelegramBotDisableWebPagePreview bool TelegramBotDisableNotification bool + TelegramBotDisableButtons bool LinkdingEnabled bool LinkdingURL string LinkdingAPIKey string @@ -119,6 +120,7 @@ func (i IntegrationForm) Merge(integration *model.Integration) { integration.TelegramBotTopicID = i.TelegramBotTopicID integration.TelegramBotDisableWebPagePreview = i.TelegramBotDisableWebPagePreview integration.TelegramBotDisableNotification = i.TelegramBotDisableNotification + integration.TelegramBotDisableButtons = i.TelegramBotDisableButtons integration.LinkdingEnabled = i.LinkdingEnabled integration.LinkdingURL = i.LinkdingURL integration.LinkdingAPIKey = i.LinkdingAPIKey @@ -187,6 +189,7 @@ func NewIntegrationForm(r *http.Request) *IntegrationForm { TelegramBotTopicID: optionalInt64Field(r.FormValue("telegram_bot_topic_id")), TelegramBotDisableWebPagePreview: r.FormValue("telegram_bot_disable_web_page_preview") == "1", TelegramBotDisableNotification: r.FormValue("telegram_bot_disable_notification") == "1", + TelegramBotDisableButtons: r.FormValue("telegram_bot_disable_buttons") == "1", LinkdingEnabled: r.FormValue("linkding_enabled") == "1", LinkdingURL: r.FormValue("linkding_url"), LinkdingAPIKey: r.FormValue("linkding_api_key"), diff --git a/internal/ui/integration_show.go b/internal/ui/integration_show.go index 9f091774..e3dbc08d 100644 --- a/internal/ui/integration_show.go +++ b/internal/ui/integration_show.go @@ -67,6 +67,7 @@ func (h *handler) showIntegrationPage(w http.ResponseWriter, r *http.Request) { TelegramBotTopicID: integration.TelegramBotTopicID, TelegramBotDisableWebPagePreview: integration.TelegramBotDisableWebPagePreview, TelegramBotDisableNotification: integration.TelegramBotDisableNotification, + TelegramBotDisableButtons: integration.TelegramBotDisableButtons, LinkdingEnabled: integration.LinkdingEnabled, LinkdingURL: integration.LinkdingURL, LinkdingAPIKey: integration.LinkdingAPIKey,