static_favicon.go 799 B

12345678910111213141516171819202122232425262728
  1. // Copyright 2018 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. "encoding/base64"
  7. "net/http"
  8. "time"
  9. "github.com/miniflux/miniflux/http/response"
  10. "github.com/miniflux/miniflux/http/response/html"
  11. "github.com/miniflux/miniflux/logger"
  12. "github.com/miniflux/miniflux/ui/static"
  13. )
  14. // Favicon renders the application favicon.
  15. func (c *Controller) Favicon(w http.ResponseWriter, r *http.Request) {
  16. blob, err := base64.StdEncoding.DecodeString(static.Binaries["favicon.ico"])
  17. if err != nil {
  18. logger.Error("[Controller:Favicon] %v", err)
  19. html.NotFound(w)
  20. return
  21. }
  22. response.Cache(w, r, "image/x-icon", static.BinariesChecksums["favicon.ico"], blob, 48*time.Hour)
  23. }