2018-04-29 19:35:04 -04:00
|
|
|
// Copyright 2017 Frédéric Guillot. All rights reserved.
|
|
|
|
// Use of this source code is governed by the Apache 2.0
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
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,
|
|
|
|
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,
|
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,
|
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
|
|
|
}
|