From bb8620f73ec52fc6fea20088210f73668d7f6067 Mon Sep 17 00:00:00 2001 From: rimu <3310831+rimu@users.noreply.github.com> Date: Wed, 10 Jul 2024 21:40:06 +0800 Subject: [PATCH] let's not have jinja able to access config variables #261 --- app/templates/_side_pane.html | 2 +- pyfedi.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/templates/_side_pane.html b/app/templates/_side_pane.html index 5cae4e67..4c1e2089 100644 --- a/app/templates/_side_pane.html +++ b/app/templates/_side_pane.html @@ -49,7 +49,7 @@ {% endif -%} {% if community.local_only -%} -

{{ _('Only people on %(instance_name)s can post or reply in this community.', instance_name=current_app.config['SERVER_NAME']) }}

+

{{ _('Only people on %(instance_domain)s can post or reply in this community.', instance_domain=instance_domain) }}

{% endif -%} {% if rss_feed -%}

diff --git a/pyfedi.py b/pyfedi.py index 45c9b59b..d82f222c 100644 --- a/pyfedi.py +++ b/pyfedi.py @@ -22,7 +22,8 @@ cli.register(app) def app_context_processor(): def getmtime(filename): return os.path.getmtime('app/static/' + filename) - return dict(getmtime=getmtime, POST_TYPE_LINK=POST_TYPE_LINK, POST_TYPE_IMAGE=POST_TYPE_IMAGE, + return dict(getmtime=getmtime, instance_domain=current_app.config['SERVER_NAME'], + POST_TYPE_LINK=POST_TYPE_LINK, POST_TYPE_IMAGE=POST_TYPE_IMAGE, POST_TYPE_ARTICLE=POST_TYPE_ARTICLE, POST_TYPE_VIDEO=POST_TYPE_VIDEO, POST_TYPE_POLL=POST_TYPE_POLL) @@ -32,7 +33,6 @@ def make_shell_context(): with app.app_context(): - app.jinja_env.globals['getmtime'] = getmtime app.jinja_env.globals['len'] = len app.jinja_env.globals['digits'] = digits app.jinja_env.globals['str'] = str