integration_show.go 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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. NotionEnabled: integration.NotionEnabled,
  43. NotionPageID: integration.NotionPageID,
  44. NotionToken: integration.NotionToken,
  45. NunuxKeeperEnabled: integration.NunuxKeeperEnabled,
  46. NunuxKeeperURL: integration.NunuxKeeperURL,
  47. NunuxKeeperAPIKey: integration.NunuxKeeperAPIKey,
  48. EspialEnabled: integration.EspialEnabled,
  49. EspialURL: integration.EspialURL,
  50. EspialAPIKey: integration.EspialAPIKey,
  51. EspialTags: integration.EspialTags,
  52. ReadwiseEnabled: integration.ReadwiseEnabled,
  53. ReadwiseAPIKey: integration.ReadwiseAPIKey,
  54. TelegramBotEnabled: integration.TelegramBotEnabled,
  55. TelegramBotToken: integration.TelegramBotToken,
  56. TelegramBotChatID: integration.TelegramBotChatID,
  57. TelegramBotTopicID: integration.TelegramBotTopicID,
  58. TelegramBotDisableWebPagePreview: integration.TelegramBotDisableWebPagePreview,
  59. TelegramBotDisableNotification: integration.TelegramBotDisableNotification,
  60. TelegramBotDisableButtons: integration.TelegramBotDisableButtons,
  61. LinkAceEnabled: integration.LinkAceEnabled,
  62. LinkAceURL: integration.LinkAceURL,
  63. LinkAceAPIKey: integration.LinkAceAPIKey,
  64. LinkAceTags: integration.LinkAceTags,
  65. LinkAcePrivate: integration.LinkAcePrivate,
  66. LinkAceCheckDisabled: integration.LinkAceCheckDisabled,
  67. LinkdingEnabled: integration.LinkdingEnabled,
  68. LinkdingURL: integration.LinkdingURL,
  69. LinkdingAPIKey: integration.LinkdingAPIKey,
  70. LinkdingTags: integration.LinkdingTags,
  71. LinkdingMarkAsUnread: integration.LinkdingMarkAsUnread,
  72. LinkwardenEnabled: integration.LinkwardenEnabled,
  73. LinkwardenURL: integration.LinkwardenURL,
  74. LinkwardenAPIKey: integration.LinkwardenAPIKey,
  75. MatrixBotEnabled: integration.MatrixBotEnabled,
  76. MatrixBotUser: integration.MatrixBotUser,
  77. MatrixBotPassword: integration.MatrixBotPassword,
  78. MatrixBotURL: integration.MatrixBotURL,
  79. MatrixBotChatID: integration.MatrixBotChatID,
  80. AppriseEnabled: integration.AppriseEnabled,
  81. AppriseURL: integration.AppriseURL,
  82. AppriseServicesURL: integration.AppriseServicesURL,
  83. ReadeckEnabled: integration.ReadeckEnabled,
  84. ReadeckURL: integration.ReadeckURL,
  85. ReadeckAPIKey: integration.ReadeckAPIKey,
  86. ReadeckLabels: integration.ReadeckLabels,
  87. ReadeckOnlyURL: integration.ReadeckOnlyURL,
  88. ShioriEnabled: integration.ShioriEnabled,
  89. ShioriURL: integration.ShioriURL,
  90. ShioriUsername: integration.ShioriUsername,
  91. ShioriPassword: integration.ShioriPassword,
  92. ShaarliEnabled: integration.ShaarliEnabled,
  93. ShaarliURL: integration.ShaarliURL,
  94. ShaarliAPISecret: integration.ShaarliAPISecret,
  95. WebhookEnabled: integration.WebhookEnabled,
  96. WebhookURL: integration.WebhookURL,
  97. WebhookSecret: integration.WebhookSecret,
  98. RSSBridgeEnabled: integration.RSSBridgeEnabled,
  99. RSSBridgeURL: integration.RSSBridgeURL,
  100. RSSBridgeToken: integration.RSSBridgeToken,
  101. OmnivoreEnabled: integration.OmnivoreEnabled,
  102. OmnivoreAPIKey: integration.OmnivoreAPIKey,
  103. OmnivoreURL: integration.OmnivoreURL,
  104. KarakeepEnabled: integration.KarakeepEnabled,
  105. KarakeepAPIKey: integration.KarakeepAPIKey,
  106. KarakeepURL: integration.KarakeepURL,
  107. RaindropEnabled: integration.RaindropEnabled,
  108. RaindropToken: integration.RaindropToken,
  109. RaindropCollectionID: integration.RaindropCollectionID,
  110. RaindropTags: integration.RaindropTags,
  111. BetulaEnabled: integration.BetulaEnabled,
  112. BetulaURL: integration.BetulaURL,
  113. BetulaToken: integration.BetulaToken,
  114. NtfyEnabled: integration.NtfyEnabled,
  115. NtfyTopic: integration.NtfyTopic,
  116. NtfyURL: integration.NtfyURL,
  117. NtfyAPIToken: integration.NtfyAPIToken,
  118. NtfyUsername: integration.NtfyUsername,
  119. NtfyPassword: integration.NtfyPassword,
  120. NtfyIconURL: integration.NtfyIconURL,
  121. NtfyInternalLinks: integration.NtfyInternalLinks,
  122. CuboxEnabled: integration.CuboxEnabled,
  123. CuboxAPILink: integration.CuboxAPILink,
  124. DiscordEnabled: integration.DiscordEnabled,
  125. DiscordWebhookLink: integration.DiscordWebhookLink,
  126. SlackEnabled: integration.SlackEnabled,
  127. SlackWebhookLink: integration.SlackWebhookLink,
  128. PushoverEnabled: integration.PushoverEnabled,
  129. PushoverUser: integration.PushoverUser,
  130. PushoverToken: integration.PushoverToken,
  131. PushoverDevice: integration.PushoverDevice,
  132. PushoverPrefix: integration.PushoverPrefix,
  133. }
  134. sess := session.New(h.store, request.SessionID(r))
  135. view := view.New(h.tpl, r, sess)
  136. view.Set("form", integrationForm)
  137. view.Set("menu", "settings")
  138. view.Set("user", user)
  139. view.Set("countUnread", h.store.CountUnreadEntries(user.ID))
  140. view.Set("countErrorFeeds", h.store.CountUserFeedsWithErrors(user.ID))
  141. html.OK(w, r, view.Render("integrations"))
  142. }