aboutsummaryrefslogtreecommitdiffhomepage
path: root/http
diff options
context:
space:
mode:
authorGravatar Frédéric Guillot <fred@miniflux.net>2018-07-18 22:30:05 -0700
committerGravatar Frédéric Guillot <fred@miniflux.net>2018-07-18 22:30:05 -0700
commita291d8a38b40569fdd1f00125ca0b29e4b9264f2 (patch)
tree13345ce7b413d9919521de258e60954467afcda0 /http
parentc1ab27172c0d82f9289aeb3402056f727bc473fd (diff)
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 'http')
-rw-r--r--http/context/context.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/http/context/context.go b/http/context/context.go
index f0fed23..4ca95c5 100644
--- a/http/context/context.go
+++ b/http/context/context.go
@@ -48,6 +48,15 @@ func (c *Context) UserLanguage() string {
return language
}
+// UserTheme get the theme used by the current logged user.
+func (c *Context) UserTheme() string {
+ theme := c.getContextStringValue(middleware.UserThemeContextKey)
+ if theme == "" {
+ theme = "default"
+ }
+ return theme
+}
+
// CSRF returns the current CSRF token.
func (c *Context) CSRF() string {
return c.getContextStringValue(middleware.CSRFContextKey)