Feat: styles and session
This commit is contained in:
		| @@ -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 | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Grail Finder
					Grail Finder