new: dev: initialize the GTK client #11
This commit is contained in:
45
gtk-client/mineseeker/state/session.py
Normal file
45
gtk-client/mineseeker/state/session.py
Normal file
@@ -0,0 +1,45 @@
|
||||
"""
|
||||
This file is part of the SplendidBear Websites' projects.
|
||||
|
||||
Copyright (c) 2026 @ www.splendidbear.org
|
||||
|
||||
For the full copyright and license information, please view the LICENSE
|
||||
file that was distributed with this source code.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass, field
|
||||
|
||||
|
||||
@dataclass
|
||||
class Session:
|
||||
"""Holds the current player's identity and game association."""
|
||||
|
||||
# Username (real user) or "anon_<session_id>" for guests
|
||||
username: str = ""
|
||||
|
||||
# Whether this is an authenticated (non-guest) user
|
||||
is_authenticated: bool = False
|
||||
|
||||
# Current game association UUID
|
||||
game_assoc: str = ""
|
||||
|
||||
# "red" or "blue" — assigned when both players are subscribed
|
||||
color: str = ""
|
||||
|
||||
# Mercure subscriber JWT for the current game
|
||||
mercure_jwt: str = ""
|
||||
|
||||
|
||||
# Module-level singleton; reset on logout
|
||||
_session: Session = Session()
|
||||
|
||||
|
||||
def get() -> Session:
|
||||
return _session
|
||||
|
||||
|
||||
def reset() -> None:
|
||||
global _session
|
||||
_session = Session()
|
||||
Reference in New Issue
Block a user