Add context processor to expose matrix_chat_available to templates
This commit is contained in:
@@ -27,6 +27,12 @@ def init_app(app, server_url='', room_alias='', base_template='layout.html', log
|
|||||||
app.register_blueprint(blueprint)
|
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
|
@blueprint.before_request
|
||||||
def _auth_guard():
|
def _auth_guard():
|
||||||
login_endpoint = current_app.config.get('MATRIX_CHAT_LOGIN_ENDPOINT')
|
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_server=current_app.config.get('MATRIX_SERVER_URL', ''),
|
||||||
matrix_room_alias=current_app.config.get('MATRIX_ROOM_ALIAS', ''),
|
matrix_room_alias=current_app.config.get('MATRIX_ROOM_ALIAS', ''),
|
||||||
base_template=current_app.config.get('MATRIX_CHAT_BASE', 'layout.html'),
|
base_template=current_app.config.get('MATRIX_CHAT_BASE', 'layout.html'),
|
||||||
|
page='chat',
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user