1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-01 17:38:37 +00:00

Add web manifest file

This commit is contained in:
Frédéric Guillot 2017-12-22 20:16:49 -08:00
parent f6a5d7d6ed
commit 589aee9f89
5 changed files with 38 additions and 3 deletions

View file

@ -63,3 +63,35 @@ func (c *Controller) AppIcon(ctx *core.Context, request *core.Request, response
response.Cache("image/png", static.BinariesChecksums[filename], blob, 48*time.Hour)
}
// WebManifest renders web manifest file.
func (c *Controller) WebManifest(ctx *core.Context, request *core.Request, response *core.Response) {
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: ctx.Route("unread"),
Icons: []webManifestIcon{
webManifestIcon{Source: ctx.Route("appIcon", "filename", "touch-icon-ipad-retina.png"), Sizes: "144x144", Type: "image/png"},
webManifestIcon{Source: ctx.Route("appIcon", "filename", "touch-icon-iphone-retina.png"), Sizes: "114x114", Type: "image/png"},
},
}
response.JSON().Standard(manifest)
}