Added centralized templating system with static asset serving.
CI / Formatting (push) Successful in 13s
CI / Linting (push) Successful in 14s
CI / Tests (Python 3.12) (push) Failing after 29s
CI / Tests (Python 3.13) (push) Failing after 29s
CI / Tests (Python 3.14) (push) Failing after 26s
CI / Type Checking (push) Failing after 25s
CI / Spelling (push) Successful in 13s
CI / Formatting (push) Successful in 13s
CI / Linting (push) Successful in 14s
CI / Tests (Python 3.12) (push) Failing after 29s
CI / Tests (Python 3.13) (push) Failing after 29s
CI / Tests (Python 3.14) (push) Failing after 26s
CI / Type Checking (push) Failing after 25s
CI / Spelling (push) Successful in 13s
This commit is contained in:
@@ -40,6 +40,7 @@ if TYPE_CHECKING:
|
||||
from .owncast_admin_client import OwncastAdminClient
|
||||
from .owncast_client import OwncastClient
|
||||
from .storage import ModuleStorage
|
||||
from .templates import ModuleTemplates
|
||||
|
||||
|
||||
@dataclass
|
||||
@@ -74,6 +75,9 @@ class ModuleContext:
|
||||
# Shared HTTP client for making web requests.
|
||||
http: HttpClient
|
||||
|
||||
# Module-scoped Jinja2 template rendering.
|
||||
templates: ModuleTemplates
|
||||
|
||||
# Optional admin client for the Owncast Admin API (None if admin is not enabled).
|
||||
admin_client: OwncastAdminClient | None = None
|
||||
|
||||
@@ -164,6 +168,11 @@ class EventContext[E]:
|
||||
"""Shared HTTP client for making web requests."""
|
||||
return self.module.http
|
||||
|
||||
@property
|
||||
def templates(self) -> ModuleTemplates:
|
||||
"""Module-scoped Jinja2 template rendering."""
|
||||
return self.module.templates
|
||||
|
||||
@property
|
||||
def admin_client(self) -> OwncastAdminClient | None:
|
||||
"""Optional client for the Owncast Admin API (None if admin is not enabled)."""
|
||||
@@ -284,6 +293,11 @@ class CommandContext:
|
||||
"""Shared HTTP client for making web requests."""
|
||||
return self.module.http
|
||||
|
||||
@property
|
||||
def templates(self) -> ModuleTemplates:
|
||||
"""Module-scoped Jinja2 template rendering."""
|
||||
return self.module.templates
|
||||
|
||||
@property
|
||||
def admin_client(self) -> OwncastAdminClient | None:
|
||||
"""Optional client for the Owncast Admin API (None if admin is not enabled)."""
|
||||
@@ -353,6 +367,11 @@ class RouteContext:
|
||||
"""Shared HTTP client for making web requests."""
|
||||
return self.module.http
|
||||
|
||||
@property
|
||||
def templates(self) -> ModuleTemplates:
|
||||
"""Module-scoped Jinja2 template rendering."""
|
||||
return self.module.templates
|
||||
|
||||
@property
|
||||
def admin_client(self) -> OwncastAdminClient | None:
|
||||
"""Optional client for the Owncast Admin API (None if admin is not enabled)."""
|
||||
|
||||
Reference in New Issue
Block a user