Add configurable grid branding

This commit is contained in:
Jage9
2026-03-09 01:21:02 -04:00
parent 25a71e0a77
commit 6aaa49bed3
12 changed files with 83 additions and 6 deletions

View File

@@ -14,6 +14,11 @@ class ServerConfigSection(BaseModel):
bind_ip: str = "127.0.0.1"
port: int = 8765
base_path: str = "/"
grid_name: str = "Chat Grid"
welcome_message: str = (
"Welcome to the Chat Grid, your immersive audio playground. "
"Configure your audio, then Log in or register to join the grid."
)
class NetworkConfigSection(BaseModel):

View File

@@ -242,6 +242,8 @@ class AuthRequiredPacket(BasePacket):
type: Literal["auth_required"]
message: str
authPolicy: dict | None = None
gridName: str | None = None
welcomeMessage: str | None = None
class AuthResultPacket(BasePacket):

View File

@@ -165,6 +165,11 @@ class SignalingServer:
state_save_max_delay_ms: int = 1000,
host_origin: str | None = None,
base_path: str = "/",
grid_name: str = "Chat Grid",
welcome_message: str = (
"Welcome to the Chat Grid, your immersive audio playground. "
"Configure your audio, then Log in or register to join the grid."
),
):
"""Initialize runtime state, TLS context, and item service."""
@@ -194,6 +199,11 @@ class SignalingServer:
self.server_version = self._resolve_server_version()
self.host_origin = normalize_origin(host_origin, field_name="host origin") if host_origin else None
self.base_path = self._normalize_base_path(base_path)
self.grid_name = str(grid_name).strip() or "Chat Grid"
self.welcome_message = (
str(welcome_message).strip()
or "Welcome to the Chat Grid, your immersive audio playground. Configure your audio, then Log in or register to join the grid."
)
self.auth_session_cookie_name = self._session_cookie_name_for_base_path(self.base_path)
self.websocket_path = self._base_path_join(WEBSOCKET_PATH)
self.auth_session_cookie_set_path = self._base_path_join(AUTH_SESSION_COOKIE_SET_PATH)
@@ -1493,6 +1503,8 @@ class SignalingServer:
type="auth_required",
message="Authentication required.",
authPolicy=self._auth_policy(),
gridName=self.grid_name,
welcomeMessage=self.welcome_message,
),
)
async for raw_message in websocket:
@@ -1549,7 +1561,12 @@ class SignalingServer:
"movementMaxStepsPerTick": self.movement_max_steps_per_tick,
},
uiDefinitions=self._build_ui_definitions(client),
serverInfo={"instanceId": self.instance_id, "version": self.server_version},
serverInfo={
"instanceId": self.instance_id,
"version": self.server_version,
"gridName": self.grid_name,
"welcomeMessage": self.welcome_message,
},
auth={
"authenticated": client.authenticated,
"userId": client.user_id,
@@ -3311,5 +3328,7 @@ def run() -> None:
state_save_max_delay_ms=config.storage.state_save_max_delay_ms,
host_origin=host_origin,
base_path=config.server.base_path,
grid_name=config.server.grid_name,
welcome_message=config.server.welcome_message,
)
asyncio.run(server.start())