4
0

integration_show.go 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. // Copyright 2017 Frédéric Guillot. All rights reserved.
  2. // Use of this source code is governed by the Apache 2.0
  3. // license that can be found in the LICENSE file.
  4. package ui // import "miniflux.app/ui"
  5. import (
  6. "net/http"
  7. "miniflux.app/config"
  8. "miniflux.app/http/request"
  9. "miniflux.app/http/response/html"
  10. "miniflux.app/ui/form"
  11. "miniflux.app/ui/session"
  12. "miniflux.app/ui/view"
  13. )
  14. func (h *handler) showIntegrationPage(w http.ResponseWriter, r *http.Request) {
  15. user, err := h.store.UserByID(request.UserID(r))
  16. if err != nil {
  17. html.ServerError(w, r, err)
  18. return
  19. }
  20. integration, err := h.store.Integration(user.ID)
  21. if err != nil {
  22. html.ServerError(w, r, err)
  23. return
  24. }
  25. integrationForm := form.IntegrationForm{
  26. PinboardEnabled: integration.PinboardEnabled,
  27. PinboardToken: integration.PinboardToken,
  28. PinboardTags: integration.PinboardTags,
  29. PinboardMarkAsUnread: integration.PinboardMarkAsUnread,
  30. InstapaperEnabled: integration.InstapaperEnabled,
  31. InstapaperUsername: integration.InstapaperUsername,
  32. InstapaperPassword: integration.InstapaperPassword,
  33. FeverEnabled: integration.FeverEnabled,
  34. FeverUsername: integration.FeverUsername,
  35. GoogleReaderEnabled: integration.GoogleReaderEnabled,
  36. GoogleReaderUsername: integration.GoogleReaderUsername,
  37. WallabagEnabled: integration.WallabagEnabled,
  38. WallabagOnlyURL: integration.WallabagOnlyURL,
  39. WallabagURL: integration.WallabagURL,
  40. WallabagClientID: integration.WallabagClientID,
  41. WallabagClientSecret: integration.WallabagClientSecret,
  42. WallabagUsername: integration.WallabagUsername,
  43. WallabagPassword: integration.WallabagPassword,
  44. NunuxKeeperEnabled: integration.NunuxKeeperEnabled,
  45. NunuxKeeperURL: integration.NunuxKeeperURL,
  46. NunuxKeeperAPIKey: integration.NunuxKeeperAPIKey,
  47. EspialEnabled: integration.EspialEnabled,
  48. EspialURL: integration.EspialURL,
  49. EspialAPIKey: integration.EspialAPIKey,
  50. EspialTags: integration.EspialTags,
  51. PocketEnabled: integration.PocketEnabled,
  52. PocketAccessToken: integration.PocketAccessToken,
  53. PocketConsumerKey: integration.PocketConsumerKey,
  54. TelegramBotEnabled: integration.TelegramBotEnabled,
  55. TelegramBotToken: integration.TelegramBotToken,
  56. TelegramBotChatID: integration.TelegramBotChatID,
  57. LinkdingEnabled: integration.LinkdingEnabled,
  58. LinkdingURL: integration.LinkdingURL,
  59. LinkdingAPIKey: integration.LinkdingAPIKey,
  60. }
  61. sess := session.New(h.store, request.SessionID(r))
  62. view := view.New(h.tpl, r, sess)
  63. view.Set("form", integrationForm)
  64. view.Set("menu", "settings")
  65. view.Set("user", user)
  66. view.Set("countUnread", h.store.CountUnreadEntries(user.ID))
  67. view.Set("countErrorFeeds", h.store.CountUserFeedsWithErrors(user.ID))
  68. view.Set("hasPocketConsumerKeyConfigured", config.Opts.PocketConsumerKey("") != "")
  69. html.OK(w, r, view.Render("integrations"))
  70. }