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{
|
|
|
|
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-03 04:45:12 +01:00
|
|
|
GoogleReaderEnabled: integration.GoogleReaderEnabled,
|
|
|
|
GoogleReaderUsername: integration.GoogleReaderUsername,
|
2018-04-30 01:35:04 +02:00
|
|
|
WallabagEnabled: integration.WallabagEnabled,
|
2022-09-19 01:52:28 +02:00
|
|
|
WallabagOnlyURL: integration.WallabagOnlyURL,
|
2018-04-30 01:35:04 +02:00
|
|
|
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,
|
2018-04-30 01:35:04 +02:00
|
|
|
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,
|
2023-05-21 16:29:51 +02:00
|
|
|
LinkdingTags: integration.LinkdingTags,
|
2023-06-24 17:08:58 +02:00
|
|
|
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,
|
2023-08-13 21:48:29 +02:00
|
|
|
ShioriEnabled: integration.ShioriEnabled,
|
|
|
|
ShioriURL: integration.ShioriURL,
|
|
|
|
ShioriUsername: integration.ShioriUsername,
|
|
|
|
ShioriPassword: integration.ShioriPassword,
|
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
|
|
|
}
|