From e04aeccee444485b6aa052456f22e689b1d08c22 Mon Sep 17 00:00:00 2001 From: ryan Date: Fri, 19 Jun 2026 17:20:07 +0200 Subject: [PATCH] Add context processor to expose matrix_chat_available to templates --- matrix_iframe/__init__.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/matrix_iframe/__init__.py b/matrix_iframe/__init__.py index 2e22afb..fa98511 100644 --- a/matrix_iframe/__init__.py +++ b/matrix_iframe/__init__.py @@ -27,6 +27,12 @@ def init_app(app, server_url='', room_alias='', base_template='layout.html', log app.register_blueprint(blueprint) +@blueprint.app_context_processor +def _inject_matrix_chat(): + """Makes matrix_chat_available=True visible to all templates when the blueprint is registered.""" + return {'matrix_chat_available': True} + + @blueprint.before_request def _auth_guard(): login_endpoint = current_app.config.get('MATRIX_CHAT_LOGIN_ENDPOINT') @@ -47,4 +53,5 @@ def chat(): matrix_server=current_app.config.get('MATRIX_SERVER_URL', ''), matrix_room_alias=current_app.config.get('MATRIX_ROOM_ALIAS', ''), base_template=current_app.config.get('MATRIX_CHAT_BASE', 'layout.html'), + page='chat', )