Compare commits

..

1 Commits

Author SHA1 Message Date
Renovate d97fcec00d Update dependency shareon to v2.5.0 2024-04-17 10:01:02 +01:00
15 changed files with 18 additions and 51 deletions

View File

@ -14,9 +14,6 @@ server {
gzip_static on;
gzip on;
gzip_vary on;
set_real_ip_from 0.0.0.0/0;
real_ip_header X-Forwarded-For;
@ -42,7 +39,6 @@ server {
location / {
proxy_pass http://localhost:8080;
gzip_types *;
}
location /static {

14
package-lock.json generated
View File

@ -22,7 +22,7 @@
"lodash.throttle": "4.1.1",
"npm-run-all": "4.1.5",
"sass": "1.75.0",
"shareon": "2.4.0"
"shareon": "2.5.0"
},
"devDependencies": {
"eslint": "8.55.0",
@ -3343,9 +3343,9 @@
}
},
"node_modules/shareon": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/shareon/-/shareon-2.4.0.tgz",
"integrity": "sha512-241BnM+LziD4xYixXjpzN+jdNKjSR/tQp3DO2jD7zzDoi+a07G+lz00gyqZNn7WJrzczhrKkzC+7ZCc5AbzZrA==",
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/shareon/-/shareon-2.5.0.tgz",
"integrity": "sha512-3RaRVy7nyi49IUYXZZkvXcylaQgrtM5ZkG0oRovNJLlf2M2/guYiowzCqtIylhNJCBxT4S+c40qRv0Km6myBSQ==",
"funding": [
"https://github.com/sponsors/kytta/",
"https://liberapay.com/kytta",
@ -6300,9 +6300,9 @@
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ=="
},
"shareon": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/shareon/-/shareon-2.4.0.tgz",
"integrity": "sha512-241BnM+LziD4xYixXjpzN+jdNKjSR/tQp3DO2jD7zzDoi+a07G+lz00gyqZNn7WJrzczhrKkzC+7ZCc5AbzZrA=="
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/shareon/-/shareon-2.5.0.tgz",
"integrity": "sha512-3RaRVy7nyi49IUYXZZkvXcylaQgrtM5ZkG0oRovNJLlf2M2/guYiowzCqtIylhNJCBxT4S+c40qRv0Km6myBSQ=="
},
"shebang-command": {
"version": "1.2.0",

View File

@ -42,6 +42,6 @@
"lodash.throttle": "4.1.1",
"npm-run-all": "4.1.5",
"sass": "1.75.0",
"shareon": "2.4.0"
"shareon": "2.5.0"
}
}

View File

@ -1,5 +1,5 @@
Django==5.0.4
wagtail==5.2.5
Django==5.0.1
wagtail==5.2.2
django-environ==0.11.2
whitenoise[brotli]==6.6.0
Pygments==2.17.2
@ -28,7 +28,6 @@ django-permissions-policy==4.18.0
django-enforce-host==1.1.0
django-proxy==1.2.2
wagtail-lite-youtube-embed==0.1.0
django-minify-html==1.7.1
# DRF OpenAPI dependencies
uritemplate

View File

@ -1,5 +1,7 @@
{% extends "common/listing_page.html" %}
{% load wagtailroutablepage_tags %}
{% block hero_buttons %}
<a class="button is-radiusless" href="{{ page.tag_list_page_url }}" title="View tags"><i class="fas fa-tags" aria-hidden="true"></i></a>
{{ block.super }}

View File

@ -16,7 +16,7 @@
{% for page in page.get_similar_posts %}
{% block listing_item %}
{% include "common/listing-item.html" with show_listing_images=True %}
{% include "common/listing-item.html" %}
{% endblock %}
{% endfor %}

View File

@ -1,9 +0,0 @@
from django_minify_html.middleware import MinifyHtmlMiddleware
class CustomMinifyHtmlMiddleware(MinifyHtmlMiddleware):
minify_args = {
"do_not_minify_doctype": True,
"ensure_spec_compliant_unquoted_attribute_values": True,
"keep_spaces_between_attributes": True,
}

View File

@ -295,13 +295,6 @@ class BaseListingPage(RoutablePageMixin, BaseContentPage):
def feed(self, request: HttpRequest) -> HttpResponse:
return redirect("feed", permanent=True)
@route(r"^random/$")
def random(self, request: HttpRequest) -> HttpResponse:
page = self.get_listing_pages().order_by("?").first()
if page is None:
return redirect(self.get_url(request=request), permanent=False)
return redirect(page.get_url(request=request), permanent=False)
class ListingPage(BaseListingPage):
pass

View File

@ -1,10 +1,8 @@
{% extends "common/content_page.html" %}
{% load wagtailadmin_tags wagtailroutablepage_tags %}
{% load wagtailadmin_tags %}
{% block hero_buttons %}
<a class="button is-radiusless" href="{% routablepageurl page 'random' %}" title="View random"><i class="fas fa-dice" aria-hidden="true"></i></a>
{% if listing_pages.has_previous %}
<a class="button is-radiusless" href="{% querystring page=listing_pages.previous_page_number %}" title="Previous page"><i class="fas fa-arrow-left" aria-hidden="true"></i></a>
{% endif %}

View File

@ -77,12 +77,3 @@ class ListingPageTestCase(TestCase):
self.assertEqual(
response.context["page"].get_meta_url(), self.page.full_url + "?page=2"
)
def test_random(self) -> None:
url = self.page.url + self.page.reverse_subpage("random")
with self.assertNumQueries(10):
response = self.client.get(url)
self.assertEqual(response.status_code, 302)
self.assertIn(
response.url, [page.get_url() for page in self.page.get_listing_pages()]
)

View File

@ -9,7 +9,6 @@ class GitHubLinguistHealthCheckBackend(BaseHealthCheckBackend):
colours = _get_linguist_colours()
except Exception as e:
self.add_error(str(e))
return
if colours is None:
self.add_error("No colours provided")

View File

@ -1,6 +1,5 @@
from django.core.cache import cache
from wagtail import hooks
from wagtail.models import Page
from website.common.utils import get_page_models
@ -8,7 +7,7 @@ from .utils import SingletonPageCache
@hooks.register("after_move_page")
def clear_singleton_url_cache(page_to_move: Page) -> None:
def clear_singleton_url_cache(**kwargs: dict) -> None:
"""
Clear all page caches, in case a parent has moved
"""

View File

@ -1,7 +1,7 @@
{% load wagtailadmin_tags %}
{% for page in results %}
{% include "common/listing-item.html" with breadcrumbs=True show_listing_images=True %}
{% include "common/listing-item.html" with breadcrumbs=True %}
{% endfor %}
{% if not results and page_num == 1 %}

View File

@ -38,7 +38,7 @@ class SearchPageTestCase(TestCase):
self.assertEqual(search_input.attrs["name"], "q")
self.assertEqual(search_input.attrs["hx-get"], "results/")
self.assertNotIn("value", search_input.attrs) # Because of minify-html
self.assertEqual(search_input.attrs["value"], "")
self.assertEqual(len(soup.select(search_input.attrs["hx-target"])), 1)
self.assertEqual(len(soup.select(search_input.attrs["hx-indicator"])), 2)

View File

@ -79,7 +79,6 @@ INSTALLED_APPS = [
"wagtail_2fa",
"django_otp",
"django_otp.plugins.otp_totp",
"django_minify_html",
"health_check",
"health_check.db",
"health_check.cache",
@ -94,12 +93,12 @@ INSTALLED_APPS = [
]
MIDDLEWARE = [
"django.middleware.gzip.GZipMiddleware",
"django.middleware.security.SecurityMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
"corsheaders.middleware.CorsMiddleware",
"enforce_host.EnforceHostMiddleware",
"whitenoise.middleware.WhiteNoiseMiddleware",
"website.common.middleware.CustomMinifyHtmlMiddleware",
"django.middleware.common.CommonMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",