about.go 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. "runtime"
  7. "miniflux.app/v2/internal/config"
  8. "miniflux.app/v2/internal/http/request"
  9. "miniflux.app/v2/internal/http/response/html"
  10. "miniflux.app/v2/internal/ui/session"
  11. "miniflux.app/v2/internal/ui/view"
  12. "miniflux.app/v2/internal/version"
  13. )
  14. func (h *handler) showAboutPage(w http.ResponseWriter, r *http.Request) {
  15. user, err := h.store.UserByID(request.UserID(r))
  16. if err != nil {
  17. html.ServerError(w, r, err)
  18. return
  19. }
  20. sess := session.New(h.store, request.SessionID(r))
  21. view := view.New(h.tpl, r, sess)
  22. view.Set("version", version.Version)
  23. view.Set("commit", version.Commit)
  24. view.Set("build_date", version.BuildDate)
  25. view.Set("menu", "settings")
  26. view.Set("user", user)
  27. view.Set("countUnread", h.store.CountUnreadEntries(user.ID))
  28. view.Set("countErrorFeeds", h.store.CountUserFeedsWithErrors(user.ID))
  29. view.Set("globalConfigOptions", config.Opts.SortedOptions(true))
  30. view.Set("postgres_version", h.store.DatabaseVersion())
  31. view.Set("go_version", runtime.Version())
  32. html.OK(w, r, view.Render("about"))
  33. }