integration_show.go 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. // SPDX-FileCopyrightText: Copyright The Miniflux Authors. All rights reserved.
  2. // SPDX-License-Identifier: Apache-2.0
  3. package ui // import "miniflux.app/v2/internal/ui"
  4. import (
  5. "net/http"
  6. "miniflux.app/v2/internal/config"
  7. "miniflux.app/v2/internal/http/request"
  8. "miniflux.app/v2/internal/http/response/html"
  9. "miniflux.app/v2/internal/ui/form"
  10. "miniflux.app/v2/internal/ui/session"
  11. "miniflux.app/v2/internal/ui/view"
  12. )
  13. func (h *handler) showIntegrationPage(w http.ResponseWriter, r *http.Request) {
  14. user, err := h.store.UserByID(request.UserID(r))
  15. if err != nil {
  16. html.ServerError(w, r, err)
  17. return
  18. }
  19. integration, err := h.store.Integration(user.ID)
  20. if err != nil {
  21. html.ServerError(w, r, err)
  22. return
  23. }
  24. integrationForm := form.IntegrationForm{
  25. PinboardEnabled: integration.PinboardEnabled,
  26. PinboardToken: integration.PinboardToken,
  27. PinboardTags: integration.PinboardTags,
  28. PinboardMarkAsUnread: integration.PinboardMarkAsUnread,
  29. InstapaperEnabled: integration.InstapaperEnabled,
  30. InstapaperUsername: integration.InstapaperUsername,
  31. InstapaperPassword: integration.InstapaperPassword,
  32. FeverEnabled: integration.FeverEnabled,
  33. FeverUsername: integration.FeverUsername,
  34. GoogleReaderEnabled: integration.GoogleReaderEnabled,
  35. GoogleReaderUsername: integration.GoogleReaderUsername,
  36. WallabagEnabled: integration.WallabagEnabled,
  37. WallabagOnlyURL: integration.WallabagOnlyURL,
  38. WallabagURL: integration.WallabagURL,
  39. WallabagClientID: integration.WallabagClientID,
  40. WallabagClientSecret: integration.WallabagClientSecret,
  41. WallabagUsername: integration.WallabagUsername,
  42. WallabagPassword: integration.WallabagPassword,
  43. NotionEnabled: integration.NotionEnabled,
  44. NotionPageID: integration.NotionPageID,
  45. NotionToken: integration.NotionToken,
  46. NunuxKeeperEnabled: integration.NunuxKeeperEnabled,
  47. NunuxKeeperURL: integration.NunuxKeeperURL,
  48. NunuxKeeperAPIKey: integration.NunuxKeeperAPIKey,
  49. EspialEnabled: integration.EspialEnabled,
  50. EspialURL: integration.EspialURL,
  51. EspialAPIKey: integration.EspialAPIKey,
  52. EspialTags: integration.EspialTags,
  53. ReadwiseEnabled: integration.ReadwiseEnabled,
  54. ReadwiseAPIKey: integration.ReadwiseAPIKey,
  55. PocketEnabled: integration.PocketEnabled,
  56. PocketAccessToken: integration.PocketAccessToken,
  57. PocketConsumerKey: integration.PocketConsumerKey,
  58. TelegramBotEnabled: integration.TelegramBotEnabled,
  59. TelegramBotToken: integration.TelegramBotToken,
  60. TelegramBotChatID: integration.TelegramBotChatID,
  61. TelegramBotTopicID: integration.TelegramBotTopicID,
  62. TelegramBotDisableWebPagePreview: integration.TelegramBotDisableWebPagePreview,
  63. TelegramBotDisableNotification: integration.TelegramBotDisableNotification,
  64. TelegramBotDisableButtons: integration.TelegramBotDisableButtons,
  65. LinkAceEnabled: integration.LinkAceEnabled,
  66. LinkAceURL: integration.LinkAceURL,
  67. LinkAceAPIKey: integration.LinkAceAPIKey,
  68. LinkAceTags: integration.LinkAceTags,
  69. LinkAcePrivate: integration.LinkAcePrivate,
  70. LinkAceCheckDisabled: integration.LinkAceCheckDisabled,
  71. LinkdingEnabled: integration.LinkdingEnabled,
  72. LinkdingURL: integration.LinkdingURL,
  73. LinkdingAPIKey: integration.LinkdingAPIKey,
  74. LinkdingTags: integration.LinkdingTags,
  75. LinkdingMarkAsUnread: integration.LinkdingMarkAsUnread,
  76. MatrixBotEnabled: integration.MatrixBotEnabled,
  77. MatrixBotUser: integration.MatrixBotUser,
  78. MatrixBotPassword: integration.MatrixBotPassword,
  79. MatrixBotURL: integration.MatrixBotURL,
  80. MatrixBotChatID: integration.MatrixBotChatID,
  81. AppriseEnabled: integration.AppriseEnabled,
  82. AppriseURL: integration.AppriseURL,
  83. AppriseServicesURL: integration.AppriseServicesURL,
  84. ShioriEnabled: integration.ShioriEnabled,
  85. ShioriURL: integration.ShioriURL,
  86. ShioriUsername: integration.ShioriUsername,
  87. ShioriPassword: integration.ShioriPassword,
  88. ShaarliEnabled: integration.ShaarliEnabled,
  89. ShaarliURL: integration.ShaarliURL,
  90. ShaarliAPISecret: integration.ShaarliAPISecret,
  91. WebhookEnabled: integration.WebhookEnabled,
  92. WebhookURL: integration.WebhookURL,
  93. WebhookSecret: integration.WebhookSecret,
  94. RSSBridgeEnabled: integration.RSSBridgeEnabled,
  95. RSSBridgeURL: integration.RSSBridgeURL,
  96. OmnivoreEnabled: integration.OmnivoreEnabled,
  97. OmnivoreAPIKey: integration.OmnivoreAPIKey,
  98. OmnivoreURL: integration.OmnivoreURL,
  99. }
  100. sess := session.New(h.store, request.SessionID(r))
  101. view := view.New(h.tpl, r, sess)
  102. view.Set("form", integrationForm)
  103. view.Set("menu", "settings")
  104. view.Set("user", user)
  105. view.Set("countUnread", h.store.CountUnreadEntries(user.ID))
  106. view.Set("countErrorFeeds", h.store.CountUserFeedsWithErrors(user.ID))
  107. view.Set("hasPocketConsumerKeyConfigured", config.Opts.PocketConsumerKey("") != "")
  108. html.OK(w, r, view.Render("integrations"))
  109. }