integration_show.go 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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. LinkwardenEnabled: integration.LinkwardenEnabled,
  77. LinkwardenURL: integration.LinkwardenURL,
  78. LinkwardenAPIKey: integration.LinkwardenAPIKey,
  79. MatrixBotEnabled: integration.MatrixBotEnabled,
  80. MatrixBotUser: integration.MatrixBotUser,
  81. MatrixBotPassword: integration.MatrixBotPassword,
  82. MatrixBotURL: integration.MatrixBotURL,
  83. MatrixBotChatID: integration.MatrixBotChatID,
  84. AppriseEnabled: integration.AppriseEnabled,
  85. AppriseURL: integration.AppriseURL,
  86. AppriseServicesURL: integration.AppriseServicesURL,
  87. ReadeckEnabled: integration.ReadeckEnabled,
  88. ReadeckURL: integration.ReadeckURL,
  89. ReadeckAPIKey: integration.ReadeckAPIKey,
  90. ReadeckLabels: integration.ReadeckLabels,
  91. ReadeckOnlyURL: integration.ReadeckOnlyURL,
  92. ShioriEnabled: integration.ShioriEnabled,
  93. ShioriURL: integration.ShioriURL,
  94. ShioriUsername: integration.ShioriUsername,
  95. ShioriPassword: integration.ShioriPassword,
  96. ShaarliEnabled: integration.ShaarliEnabled,
  97. ShaarliURL: integration.ShaarliURL,
  98. ShaarliAPISecret: integration.ShaarliAPISecret,
  99. WebhookEnabled: integration.WebhookEnabled,
  100. WebhookURL: integration.WebhookURL,
  101. WebhookSecret: integration.WebhookSecret,
  102. RSSBridgeEnabled: integration.RSSBridgeEnabled,
  103. RSSBridgeURL: integration.RSSBridgeURL,
  104. OmnivoreEnabled: integration.OmnivoreEnabled,
  105. OmnivoreAPIKey: integration.OmnivoreAPIKey,
  106. OmnivoreURL: integration.OmnivoreURL,
  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. }
  122. sess := session.New(h.store, request.SessionID(r))
  123. view := view.New(h.tpl, r, sess)
  124. view.Set("form", integrationForm)
  125. view.Set("menu", "settings")
  126. view.Set("user", user)
  127. view.Set("countUnread", h.store.CountUnreadEntries(user.ID))
  128. view.Set("countErrorFeeds", h.store.CountUserFeedsWithErrors(user.ID))
  129. view.Set("hasPocketConsumerKeyConfigured", config.Opts.PocketConsumerKey("") != "")
  130. html.OK(w, r, view.Render("integrations"))
  131. }