about.go 957 B

123456789101112131415161718192021222324252627282930313233343536
  1. // Copyright 2017 Frédéric Guillot. All rights reserved.
  2. // Use of this source code is governed by the Apache 2.0
  3. // license that can be found in the LICENSE file.
  4. package ui
  5. import (
  6. "net/http"
  7. "github.com/miniflux/miniflux/http/context"
  8. "github.com/miniflux/miniflux/http/response/html"
  9. "github.com/miniflux/miniflux/ui/session"
  10. "github.com/miniflux/miniflux/ui/view"
  11. "github.com/miniflux/miniflux/version"
  12. )
  13. // About shows the about page.
  14. func (c *Controller) About(w http.ResponseWriter, r *http.Request) {
  15. ctx := context.New(r)
  16. user, err := c.store.UserByID(ctx.UserID())
  17. if err != nil {
  18. html.ServerError(w, err)
  19. return
  20. }
  21. sess := session.New(c.store, ctx)
  22. view := view.New(c.tpl, ctx, sess)
  23. view.Set("version", version.Version)
  24. view.Set("build_date", version.BuildDate)
  25. view.Set("menu", "settings")
  26. view.Set("user", user)
  27. view.Set("countUnread", c.store.CountUnreadEntries(user.ID))
  28. html.OK(w, r, view.Render("about"))
  29. }