integration_show.go 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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/http/request"
  7. "miniflux.app/v2/internal/http/response/html"
  8. "miniflux.app/v2/internal/ui/form"
  9. "miniflux.app/v2/internal/ui/session"
  10. "miniflux.app/v2/internal/ui/view"
  11. )
  12. func (h *handler) showIntegrationPage(w http.ResponseWriter, r *http.Request) {
  13. user, err := h.store.UserByID(request.UserID(r))
  14. if err != nil {
  15. html.ServerError(w, r, err)
  16. return
  17. }
  18. integration, err := h.store.Integration(user.ID)
  19. if err != nil {
  20. html.ServerError(w, r, err)
  21. return
  22. }
  23. integrationForm := form.IntegrationForm{
  24. PinboardEnabled: integration.PinboardEnabled,
  25. PinboardToken: integration.PinboardToken,
  26. PinboardTags: integration.PinboardTags,
  27. PinboardMarkAsUnread: integration.PinboardMarkAsUnread,
  28. InstapaperEnabled: integration.InstapaperEnabled,
  29. InstapaperUsername: integration.InstapaperUsername,
  30. InstapaperPassword: integration.InstapaperPassword,
  31. FeverEnabled: integration.FeverEnabled,
  32. FeverUsername: integration.FeverUsername,
  33. GoogleReaderEnabled: integration.GoogleReaderEnabled,
  34. GoogleReaderUsername: integration.GoogleReaderUsername,
  35. WallabagEnabled: integration.WallabagEnabled,
  36. WallabagOnlyURL: integration.WallabagOnlyURL,
  37. WallabagURL: integration.WallabagURL,
  38. WallabagClientID: integration.WallabagClientID,
  39. WallabagClientSecret: integration.WallabagClientSecret,
  40. WallabagUsername: integration.WallabagUsername,
  41. WallabagPassword: integration.WallabagPassword,
  42. WallabagTags: integration.WallabagTags,
  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. TelegramBotEnabled: integration.TelegramBotEnabled,
  56. TelegramBotToken: integration.TelegramBotToken,
  57. TelegramBotChatID: integration.TelegramBotChatID,
  58. TelegramBotTopicID: integration.TelegramBotTopicID,
  59. TelegramBotDisableWebPagePreview: integration.TelegramBotDisableWebPagePreview,
  60. TelegramBotDisableNotification: integration.TelegramBotDisableNotification,
  61. TelegramBotDisableButtons: integration.TelegramBotDisableButtons,
  62. LinkAceEnabled: integration.LinkAceEnabled,
  63. LinkAceURL: integration.LinkAceURL,
  64. LinkAceAPIKey: integration.LinkAceAPIKey,
  65. LinkAceTags: integration.LinkAceTags,
  66. LinkAcePrivate: integration.LinkAcePrivate,
  67. LinkAceCheckDisabled: integration.LinkAceCheckDisabled,
  68. LinkdingEnabled: integration.LinkdingEnabled,
  69. LinkdingURL: integration.LinkdingURL,
  70. LinkdingAPIKey: integration.LinkdingAPIKey,
  71. LinkdingTags: integration.LinkdingTags,
  72. LinkdingMarkAsUnread: integration.LinkdingMarkAsUnread,
  73. LinktacoEnabled: integration.LinktacoEnabled,
  74. LinktacoAPIToken: integration.LinktacoAPIToken,
  75. LinktacoOrgSlug: integration.LinktacoOrgSlug,
  76. LinktacoTags: integration.LinktacoTags,
  77. LinktacoVisibility: integration.LinktacoVisibility,
  78. LinkwardenEnabled: integration.LinkwardenEnabled,
  79. LinkwardenURL: integration.LinkwardenURL,
  80. LinkwardenAPIKey: integration.LinkwardenAPIKey,
  81. MatrixBotEnabled: integration.MatrixBotEnabled,
  82. MatrixBotUser: integration.MatrixBotUser,
  83. MatrixBotPassword: integration.MatrixBotPassword,
  84. MatrixBotURL: integration.MatrixBotURL,
  85. MatrixBotChatID: integration.MatrixBotChatID,
  86. AppriseEnabled: integration.AppriseEnabled,
  87. AppriseURL: integration.AppriseURL,
  88. AppriseServicesURL: integration.AppriseServicesURL,
  89. ReadeckEnabled: integration.ReadeckEnabled,
  90. ReadeckURL: integration.ReadeckURL,
  91. ReadeckAPIKey: integration.ReadeckAPIKey,
  92. ReadeckLabels: integration.ReadeckLabels,
  93. ReadeckOnlyURL: integration.ReadeckOnlyURL,
  94. ShioriEnabled: integration.ShioriEnabled,
  95. ShioriURL: integration.ShioriURL,
  96. ShioriUsername: integration.ShioriUsername,
  97. ShioriPassword: integration.ShioriPassword,
  98. ShaarliEnabled: integration.ShaarliEnabled,
  99. ShaarliURL: integration.ShaarliURL,
  100. ShaarliAPISecret: integration.ShaarliAPISecret,
  101. WebhookEnabled: integration.WebhookEnabled,
  102. WebhookURL: integration.WebhookURL,
  103. WebhookSecret: integration.WebhookSecret,
  104. RSSBridgeEnabled: integration.RSSBridgeEnabled,
  105. RSSBridgeURL: integration.RSSBridgeURL,
  106. RSSBridgeToken: integration.RSSBridgeToken,
  107. OmnivoreEnabled: integration.OmnivoreEnabled,
  108. OmnivoreAPIKey: integration.OmnivoreAPIKey,
  109. OmnivoreURL: integration.OmnivoreURL,
  110. KarakeepEnabled: integration.KarakeepEnabled,
  111. KarakeepAPIKey: integration.KarakeepAPIKey,
  112. KarakeepURL: integration.KarakeepURL,
  113. RaindropEnabled: integration.RaindropEnabled,
  114. RaindropToken: integration.RaindropToken,
  115. RaindropCollectionID: integration.RaindropCollectionID,
  116. RaindropTags: integration.RaindropTags,
  117. BetulaEnabled: integration.BetulaEnabled,
  118. BetulaURL: integration.BetulaURL,
  119. BetulaToken: integration.BetulaToken,
  120. NtfyEnabled: integration.NtfyEnabled,
  121. NtfyTopic: integration.NtfyTopic,
  122. NtfyURL: integration.NtfyURL,
  123. NtfyAPIToken: integration.NtfyAPIToken,
  124. NtfyUsername: integration.NtfyUsername,
  125. NtfyPassword: integration.NtfyPassword,
  126. NtfyIconURL: integration.NtfyIconURL,
  127. NtfyInternalLinks: integration.NtfyInternalLinks,
  128. CuboxEnabled: integration.CuboxEnabled,
  129. CuboxAPILink: integration.CuboxAPILink,
  130. DiscordEnabled: integration.DiscordEnabled,
  131. DiscordWebhookLink: integration.DiscordWebhookLink,
  132. SlackEnabled: integration.SlackEnabled,
  133. SlackWebhookLink: integration.SlackWebhookLink,
  134. PushoverEnabled: integration.PushoverEnabled,
  135. PushoverUser: integration.PushoverUser,
  136. PushoverToken: integration.PushoverToken,
  137. PushoverDevice: integration.PushoverDevice,
  138. PushoverPrefix: integration.PushoverPrefix,
  139. ArchiveorgEnabled: integration.ArchiveorgEnabled,
  140. }
  141. sess := session.New(h.store, request.SessionID(r))
  142. view := view.New(h.tpl, r, sess)
  143. view.Set("form", integrationForm)
  144. view.Set("menu", "settings")
  145. view.Set("user", user)
  146. view.Set("countUnread", h.store.CountUnreadEntries(user.ID))
  147. view.Set("countErrorFeeds", h.store.CountUserFeedsWithErrors(user.ID))
  148. html.OK(w, r, view.Render("integrations"))
  149. }