2023-06-19 23:42:47 +02:00
|
|
|
// SPDX-FileCopyrightText: Copyright The Miniflux Authors. All rights reserved.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
2018-04-30 01:35:04 +02:00
|
|
|
|
2023-08-11 04:46:45 +02:00
|
|
|
package ui // import "miniflux.app/v2/internal/ui"
|
2018-04-30 01:35:04 +02:00
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
2023-08-11 04:46:45 +02:00
|
|
|
"miniflux.app/v2/internal/config"
|
|
|
|
"miniflux.app/v2/internal/http/request"
|
|
|
|
"miniflux.app/v2/internal/http/response/html"
|
|
|
|
"miniflux.app/v2/internal/ui/form"
|
|
|
|
"miniflux.app/v2/internal/ui/session"
|
|
|
|
"miniflux.app/v2/internal/ui/view"
|
2018-04-30 01:35:04 +02:00
|
|
|
)
|
|
|
|
|
2018-11-11 20:28:29 +01:00
|
|
|
func (h *handler) showIntegrationPage(w http.ResponseWriter, r *http.Request) {
|
|
|
|
user, err := h.store.UserByID(request.UserID(r))
|
2018-04-30 01:35:04 +02:00
|
|
|
if err != nil {
|
2018-10-08 03:42:43 +02:00
|
|
|
html.ServerError(w, r, err)
|
2018-04-30 01:35:04 +02:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2018-11-11 20:28:29 +01:00
|
|
|
integration, err := h.store.Integration(user.ID)
|
2018-04-30 01:35:04 +02:00
|
|
|
if err != nil {
|
2018-10-08 03:42:43 +02:00
|
|
|
html.ServerError(w, r, err)
|
2018-04-30 01:35:04 +02:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
integrationForm := form.IntegrationForm{
|
2023-09-10 20:22:32 +02:00
|
|
|
PinboardEnabled: integration.PinboardEnabled,
|
|
|
|
PinboardToken: integration.PinboardToken,
|
|
|
|
PinboardTags: integration.PinboardTags,
|
|
|
|
PinboardMarkAsUnread: integration.PinboardMarkAsUnread,
|
|
|
|
InstapaperEnabled: integration.InstapaperEnabled,
|
|
|
|
InstapaperUsername: integration.InstapaperUsername,
|
|
|
|
InstapaperPassword: integration.InstapaperPassword,
|
|
|
|
FeverEnabled: integration.FeverEnabled,
|
|
|
|
FeverUsername: integration.FeverUsername,
|
|
|
|
GoogleReaderEnabled: integration.GoogleReaderEnabled,
|
|
|
|
GoogleReaderUsername: integration.GoogleReaderUsername,
|
|
|
|
WallabagEnabled: integration.WallabagEnabled,
|
|
|
|
WallabagOnlyURL: integration.WallabagOnlyURL,
|
|
|
|
WallabagURL: integration.WallabagURL,
|
|
|
|
WallabagClientID: integration.WallabagClientID,
|
|
|
|
WallabagClientSecret: integration.WallabagClientSecret,
|
|
|
|
WallabagUsername: integration.WallabagUsername,
|
|
|
|
WallabagPassword: integration.WallabagPassword,
|
|
|
|
NotionEnabled: integration.NotionEnabled,
|
|
|
|
NotionPageID: integration.NotionPageID,
|
|
|
|
NotionToken: integration.NotionToken,
|
|
|
|
NunuxKeeperEnabled: integration.NunuxKeeperEnabled,
|
|
|
|
NunuxKeeperURL: integration.NunuxKeeperURL,
|
|
|
|
NunuxKeeperAPIKey: integration.NunuxKeeperAPIKey,
|
|
|
|
EspialEnabled: integration.EspialEnabled,
|
|
|
|
EspialURL: integration.EspialURL,
|
|
|
|
EspialAPIKey: integration.EspialAPIKey,
|
|
|
|
EspialTags: integration.EspialTags,
|
|
|
|
ReadwiseEnabled: integration.ReadwiseEnabled,
|
|
|
|
ReadwiseAPIKey: integration.ReadwiseAPIKey,
|
|
|
|
PocketEnabled: integration.PocketEnabled,
|
|
|
|
PocketAccessToken: integration.PocketAccessToken,
|
|
|
|
PocketConsumerKey: integration.PocketConsumerKey,
|
|
|
|
TelegramBotEnabled: integration.TelegramBotEnabled,
|
|
|
|
TelegramBotToken: integration.TelegramBotToken,
|
|
|
|
TelegramBotChatID: integration.TelegramBotChatID,
|
|
|
|
TelegramBotTopicID: integration.TelegramBotTopicID,
|
|
|
|
TelegramBotDisableWebPagePreview: integration.TelegramBotDisableWebPagePreview,
|
|
|
|
TelegramBotDisableNotification: integration.TelegramBotDisableNotification,
|
2023-09-28 05:02:22 +02:00
|
|
|
TelegramBotDisableButtons: integration.TelegramBotDisableButtons,
|
2024-01-23 18:12:31 +01:00
|
|
|
LinkAceEnabled: integration.LinkAceEnabled,
|
|
|
|
LinkAceURL: integration.LinkAceURL,
|
|
|
|
LinkAceAPIKey: integration.LinkAceAPIKey,
|
|
|
|
LinkAceTags: integration.LinkAceTags,
|
|
|
|
LinkAcePrivate: integration.LinkAcePrivate,
|
|
|
|
LinkAceCheckDisabled: integration.LinkAceCheckDisabled,
|
2023-09-10 20:22:32 +02:00
|
|
|
LinkdingEnabled: integration.LinkdingEnabled,
|
|
|
|
LinkdingURL: integration.LinkdingURL,
|
|
|
|
LinkdingAPIKey: integration.LinkdingAPIKey,
|
|
|
|
LinkdingTags: integration.LinkdingTags,
|
|
|
|
LinkdingMarkAsUnread: integration.LinkdingMarkAsUnread,
|
2024-02-12 02:12:37 +01:00
|
|
|
LinkwardenEnabled: integration.LinkwardenEnabled,
|
|
|
|
LinkwardenURL: integration.LinkwardenURL,
|
|
|
|
LinkwardenAPIKey: integration.LinkwardenAPIKey,
|
2023-09-10 20:22:32 +02:00
|
|
|
MatrixBotEnabled: integration.MatrixBotEnabled,
|
|
|
|
MatrixBotUser: integration.MatrixBotUser,
|
|
|
|
MatrixBotPassword: integration.MatrixBotPassword,
|
|
|
|
MatrixBotURL: integration.MatrixBotURL,
|
|
|
|
MatrixBotChatID: integration.MatrixBotChatID,
|
|
|
|
AppriseEnabled: integration.AppriseEnabled,
|
|
|
|
AppriseURL: integration.AppriseURL,
|
|
|
|
AppriseServicesURL: integration.AppriseServicesURL,
|
2024-02-22 04:57:34 +01:00
|
|
|
ReadeckEnabled: integration.ReadeckEnabled,
|
|
|
|
ReadeckURL: integration.ReadeckURL,
|
|
|
|
ReadeckAPIKey: integration.ReadeckAPIKey,
|
|
|
|
ReadeckLabels: integration.ReadeckLabels,
|
|
|
|
ReadeckOnlyURL: integration.ReadeckOnlyURL,
|
2023-09-10 20:22:32 +02:00
|
|
|
ShioriEnabled: integration.ShioriEnabled,
|
|
|
|
ShioriURL: integration.ShioriURL,
|
|
|
|
ShioriUsername: integration.ShioriUsername,
|
|
|
|
ShioriPassword: integration.ShioriPassword,
|
|
|
|
ShaarliEnabled: integration.ShaarliEnabled,
|
|
|
|
ShaarliURL: integration.ShaarliURL,
|
|
|
|
ShaarliAPISecret: integration.ShaarliAPISecret,
|
|
|
|
WebhookEnabled: integration.WebhookEnabled,
|
|
|
|
WebhookURL: integration.WebhookURL,
|
|
|
|
WebhookSecret: integration.WebhookSecret,
|
2023-10-22 20:10:56 +02:00
|
|
|
RSSBridgeEnabled: integration.RSSBridgeEnabled,
|
|
|
|
RSSBridgeURL: integration.RSSBridgeURL,
|
2023-12-05 05:05:04 +01:00
|
|
|
OmnivoreEnabled: integration.OmnivoreEnabled,
|
|
|
|
OmnivoreAPIKey: integration.OmnivoreAPIKey,
|
|
|
|
OmnivoreURL: integration.OmnivoreURL,
|
2024-04-28 05:35:56 +02:00
|
|
|
RaindropEnabled: integration.RaindropEnabled,
|
|
|
|
RaindropToken: integration.RaindropToken,
|
|
|
|
RaindropCollectionID: integration.RaindropCollectionID,
|
|
|
|
RaindropTags: integration.RaindropTags,
|
2018-04-30 01:35:04 +02:00
|
|
|
}
|
|
|
|
|
2018-11-11 20:28:29 +01:00
|
|
|
sess := session.New(h.store, request.SessionID(r))
|
|
|
|
view := view.New(h.tpl, r, sess)
|
2018-04-30 01:35:04 +02:00
|
|
|
view.Set("form", integrationForm)
|
|
|
|
view.Set("menu", "settings")
|
|
|
|
view.Set("user", user)
|
2018-11-11 20:28:29 +01:00
|
|
|
view.Set("countUnread", h.store.CountUnreadEntries(user.ID))
|
2020-09-28 01:01:06 +02:00
|
|
|
view.Set("countErrorFeeds", h.store.CountUserFeedsWithErrors(user.ID))
|
2019-06-02 03:18:09 +02:00
|
|
|
view.Set("hasPocketConsumerKeyConfigured", config.Opts.PocketConsumerKey("") != "")
|
2018-04-30 01:35:04 +02:00
|
|
|
|
2018-07-07 05:39:28 +02:00
|
|
|
html.OK(w, r, view.Render("integrations"))
|
2018-04-30 01:35:04 +02:00
|
|
|
}
|