chrome/chrome/__init__.py
Michał Kopeć ef35636694 Add a per-request page-context hook
homepage puts the same handful of things on every page - who is logged in,
whether the weather and system widgets are enabled, whether to show the
admin link. Flask did that with two context processors. There is no
equivalent here, and passing the same eight keys at every render site is
the kind of repetition that goes stale one call at a time.

`ui.page_context` is a callable taking a Request and returning a dict. It
runs per render rather than once at startup, because what it returns depends
on who is asking: which group a visitor is in decides whether a tile is even
mentioned. An explicit value at the render site still wins, which is what
the test pins down.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-10-04 19:26:32 +02:00

17 lines
577 B
Python

"""Shared chrome for the internal services: page shell, design tokens,
Web Awesome, config/auth/health helpers.
Nothing in here knows what any particular service does. If a change would
need an `if service == "marketplace"`, it belongs in the service.
"""
from pathlib import Path
__version__ = "0.3.0"
PACKAGE_DIR = Path(__file__).parent
STATIC_DIR = PACKAGE_DIR / "static"
TEMPLATES_DIR = PACKAGE_DIR / "templates"
#: Web Awesome release vendored under static/wa. Written by vendor-webawesome.sh.
WEBAWESOME_VERSION = (STATIC_DIR / "wa" / "VERSION").read_text().strip()