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

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
This commit is contained in:
Frédéric Guillot 2018-07-18 22:30:05 -07:00
parent c1ab27172c
commit a291d8a38b
15 changed files with 76 additions and 31 deletions

View file

@ -55,6 +55,7 @@ func (m *Middleware) AppSession(next http.Handler) http.Handler {
ctx = context.WithValue(ctx, FlashMessageContextKey, session.Data.FlashMessage)
ctx = context.WithValue(ctx, FlashErrorMessageContextKey, session.Data.FlashErrorMessage)
ctx = context.WithValue(ctx, UserLanguageContextKey, session.Data.Language)
ctx = context.WithValue(ctx, UserThemeContextKey, session.Data.Theme)
ctx = context.WithValue(ctx, PocketRequestTokenContextKey, session.Data.PocketRequestToken)
next.ServeHTTP(w, r.WithContext(ctx))
})

View file

@ -32,6 +32,9 @@ var (
// UserLanguageContextKey is the context key to store user language.
UserLanguageContextKey = &ContextKey{"UserLanguageContextKey"}
// UserThemeContextKey is the context key to store user theme.
UserThemeContextKey = &ContextKey{"UserThemeContextKey"}
// SessionIDContextKey is the context key used to store the session ID.
SessionIDContextKey = &ContextKey{"SessionID"}