mirror of
https://git.linux-kernel.at/oliver/ivatar.git
synced 2025-11-13 03:36:23 +00:00
Remove cache control from the application, because we handel this at the frontend
This commit is contained in:
@@ -244,10 +244,6 @@ CACHES = {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
# This is 5 minutes caching for generated/resized images,
|
|
||||||
# so the sites don't hit ivatar so much - it's what's set in the HTTP header
|
|
||||||
CACHE_IMAGES_MAX_AGE = 5 * 60
|
|
||||||
|
|
||||||
CACHE_RESPONSE = True
|
CACHE_RESPONSE = True
|
||||||
|
|
||||||
# Trusted URLs for default redirection
|
# Trusted URLs for default redirection
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ from .pagan_optimized import create_optimized_pagan
|
|||||||
|
|
||||||
from ivatar.settings import AVATAR_MAX_SIZE, JPEG_QUALITY, DEFAULT_AVATAR_SIZE
|
from ivatar.settings import AVATAR_MAX_SIZE, JPEG_QUALITY, DEFAULT_AVATAR_SIZE
|
||||||
from ivatar.settings import CACHE_RESPONSE
|
from ivatar.settings import CACHE_RESPONSE
|
||||||
from ivatar.settings import CACHE_IMAGES_MAX_AGE
|
|
||||||
from ivatar.settings import TRUSTED_DEFAULT_URLS
|
from ivatar.settings import TRUSTED_DEFAULT_URLS
|
||||||
from ivatar.settings import (
|
from ivatar.settings import (
|
||||||
DEFAULT_GRAVATARPROXY,
|
DEFAULT_GRAVATARPROXY,
|
||||||
@@ -335,7 +334,6 @@ class AvatarImageView(TemplateView):
|
|||||||
)
|
)
|
||||||
|
|
||||||
response = CachingHttpResponse(uri, data, content_type=f"image/{imgformat}")
|
response = CachingHttpResponse(uri, data, content_type=f"image/{imgformat}")
|
||||||
response["Cache-Control"] = "max-age=%i" % CACHE_IMAGES_MAX_AGE
|
|
||||||
# Remove Vary header for images since language doesn't matter
|
# Remove Vary header for images since language doesn't matter
|
||||||
response["Vary"] = ""
|
response["Vary"] = ""
|
||||||
return response
|
return response
|
||||||
@@ -355,7 +353,6 @@ class AvatarImageView(TemplateView):
|
|||||||
def _return_cached_response(self, data, uri):
|
def _return_cached_response(self, data, uri):
|
||||||
data.seek(0)
|
data.seek(0)
|
||||||
response = CachingHttpResponse(uri, data, content_type="image/png")
|
response = CachingHttpResponse(uri, data, content_type="image/png")
|
||||||
response["Cache-Control"] = "max-age=%i" % CACHE_IMAGES_MAX_AGE
|
|
||||||
# Remove Vary header for images since language doesn't matter
|
# Remove Vary header for images since language doesn't matter
|
||||||
response["Vary"] = ""
|
response["Vary"] = ""
|
||||||
return response
|
return response
|
||||||
@@ -461,7 +458,6 @@ class GravatarProxyView(View):
|
|||||||
response = HttpResponse(
|
response = HttpResponse(
|
||||||
data.read(), content_type=f"image/{file_format(img.format)}"
|
data.read(), content_type=f"image/{file_format(img.format)}"
|
||||||
)
|
)
|
||||||
response["Cache-Control"] = "max-age=%i" % CACHE_IMAGES_MAX_AGE
|
|
||||||
# Remove Vary header for images since language doesn't matter
|
# Remove Vary header for images since language doesn't matter
|
||||||
response["Vary"] = ""
|
response["Vary"] = ""
|
||||||
return response
|
return response
|
||||||
@@ -590,7 +586,6 @@ class BlueskyProxyView(View):
|
|||||||
response = HttpResponse(
|
response = HttpResponse(
|
||||||
data.read(), content_type=f"image/{file_format(format)}"
|
data.read(), content_type=f"image/{file_format(format)}"
|
||||||
)
|
)
|
||||||
response["Cache-Control"] = "max-age=%i" % CACHE_IMAGES_MAX_AGE
|
|
||||||
# Remove Vary header for images since language doesn't matter
|
# Remove Vary header for images since language doesn't matter
|
||||||
response["Vary"] = ""
|
response["Vary"] = ""
|
||||||
return response
|
return response
|
||||||
|
|||||||
Reference in New Issue
Block a user