aboutsummaryrefslogtreecommitdiffhomepage
path: root/ui/static_manifest.go
diff options
context:
space:
mode:
authorGravatar Frédéric Guillot <fred@miniflux.net>2018-04-29 16:35:04 -0700
committerGravatar Frédéric Guillot <fred@miniflux.net>2018-04-29 16:35:04 -0700
commitf49b42f70f902d4da1e0fa4080e99164b331b716 (patch)
treec6bdd19f11d100c44b0d30344ec37038f649e988 /ui/static_manifest.go
parent1eba1730d1af50ed545f4fde78b22d6fb62ca11e (diff)
Use vanilla HTTP handlers (refactoring)
Diffstat (limited to 'ui/static_manifest.go')
-rw-r--r--ui/static_manifest.go44
1 files changed, 44 insertions, 0 deletions
diff --git a/ui/static_manifest.go b/ui/static_manifest.go
new file mode 100644
index 0000000..8721718
--- /dev/null
+++ b/ui/static_manifest.go
@@ -0,0 +1,44 @@
+// Copyright 2018 Frédéric Guillot. All rights reserved.
+// Use of this source code is governed by the Apache 2.0
+// license that can be found in the LICENSE file.
+
+package ui
+
+import (
+ "net/http"
+
+ "github.com/miniflux/miniflux/http/response/json"
+ "github.com/miniflux/miniflux/http/route"
+)
+
+// WebManifest renders web manifest file.
+func (c *Controller) WebManifest(w http.ResponseWriter, r *http.Request) {
+ type webManifestIcon struct {
+ Source string `json:"src"`
+ Sizes string `json:"sizes"`
+ Type string `json:"type"`
+ }
+
+ type webManifest struct {
+ Name string `json:"name"`
+ Description string `json:"description"`
+ ShortName string `json:"short_name"`
+ StartURL string `json:"start_url"`
+ Icons []webManifestIcon `json:"icons"`
+ Display string `json:"display"`
+ }
+
+ manifest := &webManifest{
+ Name: "Miniflux",
+ ShortName: "Miniflux",
+ Description: "Minimalist Feed Reader",
+ Display: "minimal-ui",
+ StartURL: route.Path(c.router, "unread"),
+ Icons: []webManifestIcon{
+ webManifestIcon{Source: route.Path(c.router, "appIcon", "filename", "touch-icon-ipad-retina.png"), Sizes: "144x144", Type: "image/png"},
+ webManifestIcon{Source: route.Path(c.router, "appIcon", "filename", "touch-icon-iphone-retina.png"), Sizes: "114x114", Type: "image/png"},
+ },
+ }
+
+ json.OK(w, manifest)
+}