diff --git a/README.md b/README.md index 0dfd8b7..6e358fa 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,16 @@ -ivatar / libravatar -=================== +# ivatar / libravatar -Pipeline and coverage status -============================ +# Pipeline and coverage status [![pipeline status](https://git.linux-kernel.at/oliver/ivatar/badges/master/pipeline.svg)](https://git.linux-kernel.at/oliver/ivatar/commits/master) [![coverage report](https://git.linux-kernel.at/oliver/ivatar/badges/master/coverage.svg)](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) - - [Code documentation (autogenerated, pycco)](http://oliver.git.linux-kernel.at/ivatar/pycco/) +- [Coverage HTML report](http://oliver.git.linux-kernel.at/ivatar) +- [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 diff --git a/config.py b/config.py index aed54fb..ac00796 100644 --- a/config.py +++ b/config.py @@ -213,7 +213,7 @@ CACHES = { "LOCATION": [ "127.0.0.1:11211", ], - #"OPTIONS": {"MAX_ENTRIES": 1000000}, + # "OPTIONS": {"MAX_ENTRIES": 1000000}, }, "filesystem": { "BACKEND": "django.core.cache.backends.filebased.FileBasedCache", diff --git a/coverage_extra_style.css b/coverage_extra_style.css index 4b36fc6..e6e6d82 100644 --- a/coverage_extra_style.css +++ b/coverage_extra_style.css @@ -1,6 +1,6 @@ .stats span.mis { - background: #faa; + background: #faa; } .text p.mis { - background: #faa; + background: #faa; } diff --git a/ivatar/ivataraccount/templates/login.html b/ivatar/ivataraccount/templates/login.html index e71d843..c9e23d1 100644 --- a/ivatar/ivataraccount/templates/login.html +++ b/ivatar/ivataraccount/templates/login.html @@ -21,6 +21,7 @@
{% csrf_token %} +{% if next %}{% endif %}
diff --git a/ivatar/ivataraccount/views.py b/ivatar/ivataraccount/views.py index 15ac030..3b03d90 100644 --- a/ivatar/ivataraccount/views.py +++ b/ivatar/ivataraccount/views.py @@ -1109,6 +1109,10 @@ class IvatarLoginView(LoginView): """ if request.user: 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 super().get(self, request, args, kwargs) diff --git a/ivatar/views.py b/ivatar/views.py index fa5f6a5..562d90c 100644 --- a/ivatar/views.py +++ b/ivatar/views.py @@ -118,13 +118,16 @@ class AvatarImageView(TemplateView): if centry := caches["filesystem"].get(uri): # For DEBUG purpose only # print('Cached entry for %s' % uri) - return HttpResponse( + response = HttpResponse( centry["content"], content_type=centry["content_type"], status=centry["status"], reason=centry["reason"], 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 if "digest" not in kwargs: @@ -294,6 +297,8 @@ class AvatarImageView(TemplateView): imgformat = "jpeg" 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 + response["Vary"] = "" return response def _redirect_static_w_size(self, arg0, size): @@ -312,6 +317,8 @@ class AvatarImageView(TemplateView): data.seek(0) 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 + response["Vary"] = "" return response 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)}" ) response["Cache-Control"] = "max-age=%i" % CACHE_IMAGES_MAX_AGE + # Remove Vary header for images since language doesn't matter + response["Vary"] = "" return response except ValueError as exc: @@ -526,6 +535,8 @@ class BlueskyProxyView(View): 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 + response["Vary"] = "" return response except ValueError as exc: print(f"Value error: {exc}")