Feat: styles and session

This commit is contained in:
Grail Finder
2025-05-02 12:34:58 +03:00
parent d18855cd49
commit cd1100d4b1
10 changed files with 164 additions and 13 deletions

View File

@ -6,17 +6,10 @@ import (
"crypto/sha256"
"encoding/base64"
"errors"
"golias/config"
"golias/pkg/cache"
"net/http"
"time"
)
var (
cfg config.Config
memcache cache.Cache
)
// responseWriterWrapper wraps http.ResponseWriter to capture status code
type responseWriterWrapper struct {
http.ResponseWriter
@ -99,6 +92,8 @@ func GetSession(next http.Handler) http.Handler {
}
ctx := context.WithValue(r.Context(),
"username", userSession.Username)
ctx = context.WithValue(r.Context(),
"session", userSession)
if err := cacheSetSession(sessionToken,
userSession); err != nil {
msg := "failed to marshal user session"