bookwyrm-mastodon/bookwyrm/context_processors.py

20 lines
754 B
Python
Raw Normal View History

2021-03-08 11:49:10 -05:00
""" customize the info available in context for rendering templates """
from bookwyrm import models, settings
2020-12-11 15:31:02 -05:00
2021-03-08 11:49:10 -05:00
def site_settings(request): # pylint: disable=unused-argument
2021-04-26 12:15:42 -04:00
"""include the custom info about the site"""
request_protocol = "https://"
if not request.is_secure():
request_protocol = "http://"
2021-05-26 12:20:22 -04:00
return {
"site": models.SiteSettings.objects.get(),
2021-05-19 18:17:32 -04:00
"active_announcements": models.Announcement.active_announcements(),
2021-08-04 05:42:18 -04:00
"thumbnail_generation_enabled": settings.ENABLE_THUMBNAIL_GENERATION,
"media_full_url": settings.MEDIA_FULL_URL,
"preview_images_enabled": settings.ENABLE_PREVIEW_IMAGES,
2021-05-26 12:20:22 -04:00
"request_protocol": request_protocol,
"js_cache": settings.JS_CACHE,
}