mirror of
https://git.linux-kernel.at/oliver/ivatar.git
synced 2025-11-11 10:46:24 +00:00
Hotfixes from devel
This commit is contained in:
16
README.md
16
README.md
@@ -1,20 +1,16 @@
|
|||||||
ivatar / libravatar
|
# ivatar / libravatar
|
||||||
===================
|
|
||||||
|
|
||||||
Pipeline and coverage status
|
# Pipeline and coverage status
|
||||||
============================
|
|
||||||
|
|
||||||
[](https://git.linux-kernel.at/oliver/ivatar/commits/master)
|
[](https://git.linux-kernel.at/oliver/ivatar/commits/master)
|
||||||
[](http://git.linux-kernel.at/oliver/ivatar/commits/master)
|
[](http://git.linux-kernel.at/oliver/ivatar/commits/master)
|
||||||
|
|
||||||
Reports / code documentation
|
# Reports / code documentation
|
||||||
============================
|
|
||||||
|
|
||||||
- [Coverage HTML report](http://oliver.git.linux-kernel.at/ivatar)
|
- [Coverage HTML report](http://oliver.git.linux-kernel.at/ivatar)
|
||||||
- [Code documentation (autogenerated, pycco)](http://oliver.git.linux-kernel.at/ivatar/pycco/)
|
- [Code documentation (autogenerated, pycco)](http://oliver.git.linux-kernel.at/ivatar/pycco/)
|
||||||
|
|
||||||
Authors and contributors
|
# Authors and contributors
|
||||||
========================
|
|
||||||
|
|
||||||
Lead developer/Owner: Oliver Falk (aka ofalk or falko) - https://git.linux-kernel.at/oliver
|
Lead developer/Owner: Oliver Falk (aka ofalk or falko) - https://git.linux-kernel.at/oliver
|
||||||
|
|
||||||
|
|||||||
@@ -213,7 +213,7 @@ CACHES = {
|
|||||||
"LOCATION": [
|
"LOCATION": [
|
||||||
"127.0.0.1:11211",
|
"127.0.0.1:11211",
|
||||||
],
|
],
|
||||||
#"OPTIONS": {"MAX_ENTRIES": 1000000},
|
# "OPTIONS": {"MAX_ENTRIES": 1000000},
|
||||||
},
|
},
|
||||||
"filesystem": {
|
"filesystem": {
|
||||||
"BACKEND": "django.core.cache.backends.filebased.FileBasedCache",
|
"BACKEND": "django.core.cache.backends.filebased.FileBasedCache",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
.stats span.mis {
|
.stats span.mis {
|
||||||
background: #faa;
|
background: #faa;
|
||||||
}
|
}
|
||||||
.text p.mis {
|
.text p.mis {
|
||||||
background: #faa;
|
background: #faa;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
<div style="max-width:700px">
|
<div style="max-width:700px">
|
||||||
<form action="{% url 'login' %}" method="post" name="login">
|
<form action="{% url 'login' %}" method="post" name="login">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
{% if next %}<input type="hidden" name="next" value="{{ next }}">{% endif %}
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="id_username">{% trans 'Username' %}:</label>
|
<label for="id_username">{% trans 'Username' %}:</label>
|
||||||
<input type="text" name="username" autofocus required class="form-control" id="id_username">
|
<input type="text" name="username" autofocus required class="form-control" id="id_username">
|
||||||
|
|||||||
@@ -1109,6 +1109,10 @@ class IvatarLoginView(LoginView):
|
|||||||
"""
|
"""
|
||||||
if request.user:
|
if request.user:
|
||||||
if request.user.is_authenticated:
|
if request.user.is_authenticated:
|
||||||
|
# Respect the 'next' parameter if present
|
||||||
|
next_url = request.GET.get("next")
|
||||||
|
if next_url:
|
||||||
|
return HttpResponseRedirect(next_url)
|
||||||
return HttpResponseRedirect(reverse_lazy("profile"))
|
return HttpResponseRedirect(reverse_lazy("profile"))
|
||||||
return super().get(self, request, args, kwargs)
|
return super().get(self, request, args, kwargs)
|
||||||
|
|
||||||
|
|||||||
@@ -118,13 +118,16 @@ class AvatarImageView(TemplateView):
|
|||||||
if centry := caches["filesystem"].get(uri):
|
if centry := caches["filesystem"].get(uri):
|
||||||
# For DEBUG purpose only
|
# For DEBUG purpose only
|
||||||
# print('Cached entry for %s' % uri)
|
# print('Cached entry for %s' % uri)
|
||||||
return HttpResponse(
|
response = HttpResponse(
|
||||||
centry["content"],
|
centry["content"],
|
||||||
content_type=centry["content_type"],
|
content_type=centry["content_type"],
|
||||||
status=centry["status"],
|
status=centry["status"],
|
||||||
reason=centry["reason"],
|
reason=centry["reason"],
|
||||||
charset=centry["charset"],
|
charset=centry["charset"],
|
||||||
)
|
)
|
||||||
|
# Remove Vary header for images since language doesn't matter
|
||||||
|
response["Vary"] = ""
|
||||||
|
return response
|
||||||
|
|
||||||
# In case no digest at all is provided, return to home page
|
# In case no digest at all is provided, return to home page
|
||||||
if "digest" not in kwargs:
|
if "digest" not in kwargs:
|
||||||
@@ -294,6 +297,8 @@ class AvatarImageView(TemplateView):
|
|||||||
imgformat = "jpeg"
|
imgformat = "jpeg"
|
||||||
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
|
response["Cache-Control"] = "max-age=%i" % CACHE_IMAGES_MAX_AGE
|
||||||
|
# Remove Vary header for images since language doesn't matter
|
||||||
|
response["Vary"] = ""
|
||||||
return response
|
return response
|
||||||
|
|
||||||
def _redirect_static_w_size(self, arg0, size):
|
def _redirect_static_w_size(self, arg0, size):
|
||||||
@@ -312,6 +317,8 @@ class AvatarImageView(TemplateView):
|
|||||||
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
|
response["Cache-Control"] = "max-age=%i" % CACHE_IMAGES_MAX_AGE
|
||||||
|
# Remove Vary header for images since language doesn't matter
|
||||||
|
response["Vary"] = ""
|
||||||
return response
|
return response
|
||||||
|
|
||||||
def _return_cached_png(self, arg0, data, uri):
|
def _return_cached_png(self, arg0, data, uri):
|
||||||
@@ -407,6 +414,8 @@ class GravatarProxyView(View):
|
|||||||
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
|
response["Cache-Control"] = "max-age=%i" % CACHE_IMAGES_MAX_AGE
|
||||||
|
# Remove Vary header for images since language doesn't matter
|
||||||
|
response["Vary"] = ""
|
||||||
return response
|
return response
|
||||||
|
|
||||||
except ValueError as exc:
|
except ValueError as exc:
|
||||||
@@ -526,6 +535,8 @@ class BlueskyProxyView(View):
|
|||||||
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
|
response["Cache-Control"] = "max-age=%i" % CACHE_IMAGES_MAX_AGE
|
||||||
|
# Remove Vary header for images since language doesn't matter
|
||||||
|
response["Vary"] = ""
|
||||||
return response
|
return response
|
||||||
except ValueError as exc:
|
except ValueError as exc:
|
||||||
print(f"Value error: {exc}")
|
print(f"Value error: {exc}")
|
||||||
|
|||||||
Reference in New Issue
Block a user