diff options
author | 2018-07-18 22:30:05 -0700 | |
---|---|---|
committer | 2018-07-18 22:30:05 -0700 | |
commit | a291d8a38b40569fdd1f00125ca0b29e4b9264f2 (patch) | |
tree | 13345ce7b413d9919521de258e60954467afcda0 /ui/static_manifest.go | |
parent | c1ab27172c0d82f9289aeb3402056f727bc473fd (diff) | |
download | v2-a291d8a38b40569fdd1f00125ca0b29e4b9264f2.tar.gz v2-a291d8a38b40569fdd1f00125ca0b29e4b9264f2.tar.zst v2-a291d8a38b40569fdd1f00125ca0b29e4b9264f2.zip |
Improve themes handling
- Store user theme in session
- Logged out users will keep their theme
- Add theme background color to web manifest and meta tag
Diffstat (limited to 'ui/static_manifest.go')
-rw-r--r-- | ui/static_manifest.go | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/ui/static_manifest.go b/ui/static_manifest.go index 47de9f3a..27abaec6 100644 --- a/ui/static_manifest.go +++ b/ui/static_manifest.go @@ -7,8 +7,10 @@ package ui import ( "net/http" + "github.com/miniflux/miniflux/http/context" "github.com/miniflux/miniflux/http/response/json" "github.com/miniflux/miniflux/http/route" + "github.com/miniflux/miniflux/model" ) // WebManifest renders web manifest file. @@ -20,20 +22,27 @@ func (c *Controller) WebManifest(w http.ResponseWriter, r *http.Request) { } 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"` + 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"` + ThemeColor string `json:"theme_color"` + BackgroundColor string `json:"background_color"` } + ctx := context.New(r) + themeColor := model.ThemeColor(ctx.UserTheme()) + manifest := &webManifest{ - Name: "Miniflux", - ShortName: "Miniflux", - Description: "Minimalist Feed Reader", - Display: "minimal-ui", - StartURL: route.Path(c.router, "unread"), + Name: "Miniflux", + ShortName: "Miniflux", + Description: "Minimalist Feed Reader", + Display: "minimal-ui", + StartURL: route.Path(c.router, "unread"), + ThemeColor: themeColor, + BackgroundColor: themeColor, Icons: []webManifestIcon{ webManifestIcon{Source: route.Path(c.router, "appIcon", "filename", "icon-120.png"), Sizes: "120x120", Type: "image/png"}, webManifestIcon{Source: route.Path(c.router, "appIcon", "filename", "icon-192.png"), Sizes: "192x192", Type: "image/png"}, |