static_manifest.go 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. "net/http"
  7. "github.com/miniflux/miniflux/http/response/json"
  8. "github.com/miniflux/miniflux/http/route"
  9. )
  10. // WebManifest renders web manifest file.
  11. func (c *Controller) WebManifest(w http.ResponseWriter, r *http.Request) {
  12. type webManifestIcon struct {
  13. Source string `json:"src"`
  14. Sizes string `json:"sizes"`
  15. Type string `json:"type"`
  16. }
  17. type webManifest struct {
  18. Name string `json:"name"`
  19. Description string `json:"description"`
  20. ShortName string `json:"short_name"`
  21. StartURL string `json:"start_url"`
  22. Icons []webManifestIcon `json:"icons"`
  23. Display string `json:"display"`
  24. }
  25. manifest := &webManifest{
  26. Name: "Miniflux",
  27. ShortName: "Miniflux",
  28. Description: "Minimalist Feed Reader",
  29. Display: "minimal-ui",
  30. StartURL: route.Path(c.router, "unread"),
  31. Icons: []webManifestIcon{
  32. webManifestIcon{Source: route.Path(c.router, "appIcon", "filename", "touch-icon-ipad-retina.png"), Sizes: "144x144", Type: "image/png"},
  33. webManifestIcon{Source: route.Path(c.router, "appIcon", "filename", "touch-icon-iphone-retina.png"), Sizes: "114x114", Type: "image/png"},
  34. },
  35. }
  36. json.OK(w, manifest)
  37. }