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

@ -1,10 +1,12 @@
package handlers
import (
"context"
"crypto/hmac"
"crypto/sha256"
"encoding/base64"
"encoding/json"
"errors"
"golias/models"
"golias/utils"
"html/template"
@ -112,3 +114,12 @@ func cacheSetSession(key string, session *models.Session) error {
memcache.Expire(key, 10*60)
return nil
}
func updateRoomInSession(ctx context.Context, roomID string) (context.Context, error) {
s, ok := ctx.Value("session").(models.Session)
if !ok {
return context.TODO(), errors.New("failed to extract session from ctx")
}
s.CurrentRoom = roomID
return context.WithValue(ctx, "session", s), nil
}