miniflux/ui/integration_show.go

93 lines
3.6 KiB
Go
Raw Normal View History

// SPDX-FileCopyrightText: Copyright The Miniflux Authors. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
2018-10-08 03:42:43 +02:00
package ui // import "miniflux.app/ui"
import (
"net/http"
"miniflux.app/config"
2018-09-03 23:26:40 +02:00
"miniflux.app/http/request"
2018-08-25 06:51:50 +02:00
"miniflux.app/http/response/html"
"miniflux.app/ui/form"
"miniflux.app/ui/session"
"miniflux.app/ui/view"
)
func (h *handler) showIntegrationPage(w http.ResponseWriter, r *http.Request) {
user, err := h.store.UserByID(request.UserID(r))
if err != nil {
2018-10-08 03:42:43 +02:00
html.ServerError(w, r, err)
return
}
integration, err := h.store.Integration(user.ID)
if err != nil {
2018-10-08 03:42:43 +02:00
html.ServerError(w, r, err)
return
}
integrationForm := form.IntegrationForm{
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,
2023-07-08 00:20:14 +02:00
NotionEnabled: integration.NotionEnabled,
NotionPageID: integration.NotionPageID,
NotionToken: integration.NotionToken,
NunuxKeeperEnabled: integration.NunuxKeeperEnabled,
NunuxKeeperURL: integration.NunuxKeeperURL,
NunuxKeeperAPIKey: integration.NunuxKeeperAPIKey,
2022-04-21 04:44:47 +02:00
EspialEnabled: integration.EspialEnabled,
EspialURL: integration.EspialURL,
EspialAPIKey: integration.EspialAPIKey,
EspialTags: integration.EspialTags,
2023-07-28 05:51:44 +02:00
ReadwiseEnabled: integration.ReadwiseEnabled,
ReadwiseAPIKey: integration.ReadwiseAPIKey,
2018-05-20 22:31:56 +02:00
PocketEnabled: integration.PocketEnabled,
PocketAccessToken: integration.PocketAccessToken,
PocketConsumerKey: integration.PocketConsumerKey,
2021-09-08 05:04:22 +02:00
TelegramBotEnabled: integration.TelegramBotEnabled,
TelegramBotToken: integration.TelegramBotToken,
TelegramBotChatID: integration.TelegramBotChatID,
2022-05-23 17:53:06 +02:00
LinkdingEnabled: integration.LinkdingEnabled,
LinkdingURL: integration.LinkdingURL,
LinkdingAPIKey: integration.LinkdingAPIKey,
LinkdingTags: integration.LinkdingTags,
LinkdingMarkAsUnread: integration.LinkdingMarkAsUnread,
2022-10-14 17:18:44 +02:00
MatrixBotEnabled: integration.MatrixBotEnabled,
MatrixBotUser: integration.MatrixBotUser,
MatrixBotPassword: integration.MatrixBotPassword,
MatrixBotURL: integration.MatrixBotURL,
MatrixBotChatID: integration.MatrixBotChatID,
2023-08-01 05:55:17 +02:00
AppriseEnabled: integration.AppriseEnabled,
AppriseURL: integration.AppriseURL,
AppriseServicesURL: integration.AppriseServicesURL,
}
sess := session.New(h.store, request.SessionID(r))
view := view.New(h.tpl, r, sess)
view.Set("form", integrationForm)
view.Set("menu", "settings")
view.Set("user", user)
view.Set("countUnread", h.store.CountUnreadEntries(user.ID))
2020-09-28 01:01:06 +02:00
view.Set("countErrorFeeds", h.store.CountUserFeedsWithErrors(user.ID))
view.Set("hasPocketConsumerKeyConfigured", config.Opts.PocketConsumerKey("") != "")
html.OK(w, r, view.Render("integrations"))
}