integration_show.go 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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"
  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. response.HTMLServerError(w, r, err)
  16. return
  17. }
  18. integration, err := h.store.Integration(user.ID)
  19. if err != nil {
  20. response.HTMLServerError(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. LinkwardenCollectionID: integration.LinkwardenCollectionID,
  82. MatrixBotEnabled: integration.MatrixBotEnabled,
  83. MatrixBotUser: integration.MatrixBotUser,
  84. MatrixBotPassword: integration.MatrixBotPassword,
  85. MatrixBotURL: integration.MatrixBotURL,
  86. MatrixBotChatID: integration.MatrixBotChatID,
  87. AppriseEnabled: integration.AppriseEnabled,
  88. AppriseURL: integration.AppriseURL,
  89. AppriseServicesURL: integration.AppriseServicesURL,
  90. ReadeckEnabled: integration.ReadeckEnabled,
  91. ReadeckPushEnabled: integration.ReadeckPushEnabled,
  92. ReadeckURL: integration.ReadeckURL,
  93. ReadeckAPIKey: integration.ReadeckAPIKey,
  94. ReadeckLabels: integration.ReadeckLabels,
  95. ReadeckOnlyURL: integration.ReadeckOnlyURL,
  96. ShioriEnabled: integration.ShioriEnabled,
  97. ShioriURL: integration.ShioriURL,
  98. ShioriUsername: integration.ShioriUsername,
  99. ShioriPassword: integration.ShioriPassword,
  100. ShaarliEnabled: integration.ShaarliEnabled,
  101. ShaarliURL: integration.ShaarliURL,
  102. ShaarliAPISecret: integration.ShaarliAPISecret,
  103. WebhookEnabled: integration.WebhookEnabled,
  104. WebhookURL: integration.WebhookURL,
  105. WebhookSecret: integration.WebhookSecret,
  106. RSSBridgeEnabled: integration.RSSBridgeEnabled,
  107. RSSBridgeURL: integration.RSSBridgeURL,
  108. RSSBridgeToken: integration.RSSBridgeToken,
  109. OmnivoreEnabled: integration.OmnivoreEnabled,
  110. OmnivoreAPIKey: integration.OmnivoreAPIKey,
  111. OmnivoreURL: integration.OmnivoreURL,
  112. KarakeepEnabled: integration.KarakeepEnabled,
  113. KarakeepAPIKey: integration.KarakeepAPIKey,
  114. KarakeepURL: integration.KarakeepURL,
  115. KarakeepTags: integration.KarakeepTags,
  116. RaindropEnabled: integration.RaindropEnabled,
  117. RaindropToken: integration.RaindropToken,
  118. RaindropCollectionID: integration.RaindropCollectionID,
  119. RaindropTags: integration.RaindropTags,
  120. BetulaEnabled: integration.BetulaEnabled,
  121. BetulaURL: integration.BetulaURL,
  122. BetulaToken: integration.BetulaToken,
  123. NtfyEnabled: integration.NtfyEnabled,
  124. NtfyTopic: integration.NtfyTopic,
  125. NtfyURL: integration.NtfyURL,
  126. NtfyAPIToken: integration.NtfyAPIToken,
  127. NtfyUsername: integration.NtfyUsername,
  128. NtfyPassword: integration.NtfyPassword,
  129. NtfyIconURL: integration.NtfyIconURL,
  130. NtfyInternalLinks: integration.NtfyInternalLinks,
  131. CuboxEnabled: integration.CuboxEnabled,
  132. CuboxAPILink: integration.CuboxAPILink,
  133. DiscordEnabled: integration.DiscordEnabled,
  134. DiscordWebhookLink: integration.DiscordWebhookLink,
  135. SlackEnabled: integration.SlackEnabled,
  136. SlackWebhookLink: integration.SlackWebhookLink,
  137. PushoverEnabled: integration.PushoverEnabled,
  138. PushoverUser: integration.PushoverUser,
  139. PushoverToken: integration.PushoverToken,
  140. PushoverDevice: integration.PushoverDevice,
  141. PushoverPrefix: integration.PushoverPrefix,
  142. ArchiveorgEnabled: integration.ArchiveorgEnabled,
  143. }
  144. sess := session.New(h.store, request.SessionID(r))
  145. view := view.New(h.tpl, r, sess)
  146. view.Set("form", integrationForm)
  147. view.Set("menu", "settings")
  148. view.Set("user", user)
  149. view.Set("countUnread", h.store.CountUnreadEntries(user.ID))
  150. view.Set("countErrorFeeds", h.store.CountUserFeedsWithErrors(user.ID))
  151. response.HTML(w, r, view.Render("integrations"))
  152. }