Combines shared, blog, market, cart, events, federation, and account into a single repository. Eliminates submodule sync, sibling model copying at build time, and per-app CI orchestration. Changes: - Remove per-app .git, .gitmodules, .gitea, submodule shared/ dirs - Remove stale sibling model copies from each app - Update all 6 Dockerfiles for monorepo build context (root = .) - Add build directives to docker-compose.yml - Add single .gitea/workflows/ci.yml with change detection - Add .dockerignore for monorepo build context - Create __init__.py for federation and account (cross-app imports)
47 lines
1.0 KiB
Python
47 lines
1.0 KiB
Python
"""HTMX utilities for detecting and handling HTMX requests."""
|
|
|
|
from quart import request
|
|
|
|
|
|
def is_htmx_request() -> bool:
|
|
"""
|
|
Check if the current request is an HTMX request.
|
|
|
|
Returns:
|
|
bool: True if HX-Request header is present and true
|
|
"""
|
|
return request.headers.get("HX-Request", "").lower() == "true"
|
|
|
|
|
|
def get_htmx_target() -> str | None:
|
|
"""
|
|
Get the target element ID from HTMX request headers.
|
|
|
|
Returns:
|
|
str | None: Target element ID or None
|
|
"""
|
|
return request.headers.get("HX-Target")
|
|
|
|
|
|
def get_htmx_trigger() -> str | None:
|
|
"""
|
|
Get the trigger element ID from HTMX request headers.
|
|
|
|
Returns:
|
|
str | None: Trigger element ID or None
|
|
"""
|
|
return request.headers.get("HX-Trigger")
|
|
|
|
|
|
def should_return_fragment() -> bool:
|
|
"""
|
|
Determine if we should return a fragment vs full page.
|
|
|
|
For HTMX requests, return fragment.
|
|
For normal requests, return full page.
|
|
|
|
Returns:
|
|
bool: True if fragment should be returned
|
|
"""
|
|
return is_htmx_request()
|