Feat: add example config

This commit is contained in:
Grail Finder
2025-05-22 07:23:18 +03:00
parent ad8f1aaee2
commit 6b750cd34b
8 changed files with 66 additions and 52 deletions

View File

@ -1,12 +1,10 @@
package handlers
import (
"context"
"crypto/hmac"
"crypto/sha256"
"encoding/base64"
"encoding/json"
"errors"
"fmt"
"golias/models"
"golias/utils"
@ -178,11 +176,12 @@ func cacheSetSession(key string, session *models.Session) error {
return nil
}
func updateRoomInSession(ctx context.Context, roomID string) (context.Context, error) {
s, ok := ctx.Value(models.CtxSessionKey).(*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
}
// unused
// func updateRoomInSession(ctx context.Context, roomID string) (context.Context, error) {
// s, ok := ctx.Value(models.CtxSessionKey).(*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
// }