Add context processor to expose matrix_chat_available to templates

This commit is contained in:
ryan
2026-06-19 17:20:07 +02:00
parent 740a8a2aab
commit e04aeccee4
+7
View File
@@ -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',
)