Use global switch to enable/disable preview images

This commit is contained in:
Joachim
2021-05-28 17:00:07 +02:00
parent 878cc5cb17
commit f206f61e9a
9 changed files with 99 additions and 63 deletions

View File

@ -1,18 +1,20 @@
""" customize the info available in context for rendering templates """
from bookwyrm import models
from bookwyrm.settings import STATIC_URL, STATIC_PATH, MEDIA_URL, MEDIA_PATH
from bookwyrm import models, settings
def site_settings(request): # pylint: disable=unused-argument
"""include the custom info about the site"""
request_protocol = "https://" if request.is_secure() else "http://"
request_protocol = "https://"
if not request.is_secure():
request_protocol = "http://"
return {
"site": models.SiteSettings.objects.get(),
"active_announcements": models.Announcement.active_announcements(),
"static_url": STATIC_URL,
"media_url": MEDIA_URL,
"static_path": STATIC_PATH,
"media_path": MEDIA_PATH,
"static_url": settings.STATIC_URL,
"media_url": settings.MEDIA_URL,
"static_path": settings.STATIC_PATH,
"media_path": settings.MEDIA_PATH,
"preview_images_enabled": settings.ENABLE_PREVIEW_IMAGES,
"request_protocol": request_protocol,
}