let's not have jinja able to access config variables #261

This commit is contained in:
rimu 2024-07-10 21:40:06 +08:00
parent c45e0eeebe
commit bb8620f73e
2 changed files with 3 additions and 3 deletions

View file

@ -49,7 +49,7 @@
</ul>
{% endif -%}
{% if community.local_only -%}
<p>{{ _('Only people on %(instance_name)s can post or reply in this community.', instance_name=current_app.config['SERVER_NAME']) }}</p>
<p>{{ _('Only people on %(instance_domain)s can post or reply in this community.', instance_domain=instance_domain) }}</p>
{% endif -%}
{% if rss_feed -%}
<p class="mt-4">

View file

@ -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