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