From f66a41f6a79ac11ad2b3029298f4d194b0f087cc Mon Sep 17 00:00:00 2001 From: Richard Schreiber Date: Mon, 30 Jun 2025 09:33:42 +0200 Subject: [PATCH] Presale: remove webmanifest (#5275) * Remove webmanifest from presale * move webmanifest from presale to base urls --- src/pretix/base/views/webmanifest.py | 52 +++++++++++++++++++ .../templates/pretixcontrol/auth/base.html | 2 +- .../control/templates/pretixcontrol/base.html | 2 +- .../presale/templates/pretixpresale/base.html | 1 - src/pretix/presale/urls.py | 1 - src/pretix/presale/views/theme.py | 28 ---------- src/pretix/urls.py | 2 + 7 files changed, 56 insertions(+), 32 deletions(-) create mode 100644 src/pretix/base/views/webmanifest.py diff --git a/src/pretix/base/views/webmanifest.py b/src/pretix/base/views/webmanifest.py new file mode 100644 index 0000000000..22a31699a8 --- /dev/null +++ b/src/pretix/base/views/webmanifest.py @@ -0,0 +1,52 @@ +# +# This file is part of pretix (Community Edition). +# +# Copyright (C) 2014-2020 Raphael Michel and contributors +# Copyright (C) 2020-2021 rami.io GmbH and contributors +# +# This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General +# Public License as published by the Free Software Foundation in version 3 of the License. +# +# ADDITIONAL TERMS APPLY: Pursuant to Section 7 of the GNU Affero General Public License, additional terms are +# applicable granting you additional permissions and placing additional restrictions on your usage of this software. +# Please refer to the pretix LICENSE file to obtain the full terms applicable to this work. If you did not receive +# this file, see . +# +# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more +# details. +# +# You should have received a copy of the GNU Affero General Public License along with this program. If not, see +# . +# +from django.http import HttpResponse +from django.templatetags.static import static +from django.views.decorators.cache import cache_page + + +@cache_page(3600) +def webmanifest(request): + return HttpResponse( + """{ + "name": "", + "short_name": "", + "icons": [ + { + "src": "%s", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "%s", + "sizes": "512x512", + "type": "image/png" + } + ], + "theme_color": "#3b1c4a", + "background_color": "#3b1c4a", + "display": "standalone" +}""" % ( + static('pretixbase/img/icons/android-chrome-192x192.png'), + static('pretixbase/img/icons/android-chrome-512x512.png'), + ), content_type='text/json' + ) diff --git a/src/pretix/control/templates/pretixcontrol/auth/base.html b/src/pretix/control/templates/pretixcontrol/auth/base.html index 6956d60e6f..a4b2fafa11 100644 --- a/src/pretix/control/templates/pretixcontrol/auth/base.html +++ b/src/pretix/control/templates/pretixcontrol/auth/base.html @@ -20,7 +20,7 @@ {% endif %} - + diff --git a/src/pretix/control/templates/pretixcontrol/base.html b/src/pretix/control/templates/pretixcontrol/base.html index 576f6e410e..639ebc01dd 100644 --- a/src/pretix/control/templates/pretixcontrol/base.html +++ b/src/pretix/control/templates/pretixcontrol/base.html @@ -79,7 +79,7 @@ {% endif %} - + diff --git a/src/pretix/presale/templates/pretixpresale/base.html b/src/pretix/presale/templates/pretixpresale/base.html index a967247be2..ede142b672 100644 --- a/src/pretix/presale/templates/pretixpresale/base.html +++ b/src/pretix/presale/templates/pretixpresale/base.html @@ -37,7 +37,6 @@ {% endif %} - diff --git a/src/pretix/presale/urls.py b/src/pretix/presale/urls.py index 18089751d5..0430474997 100644 --- a/src/pretix/presale/urls.py +++ b/src/pretix/presale/urls.py @@ -236,6 +236,5 @@ locale_patterns = [ re_path(r'^locale/set$', pretix.presale.views.locale.LocaleSet.as_view(), name='locale.set'), re_path(r'^robots.txt$', pretix.presale.views.robots.robots_txt, name='robots.txt'), re_path(r'^browserconfig.xml$', pretix.presale.views.theme.browserconfig_xml, name='browserconfig.xml'), - re_path(r'^site.webmanifest$', pretix.presale.views.theme.webmanifest, name='site.webmanifest'), path('widget/v..js', pretix.presale.views.widget.widget_js, name='widget.js'), ] diff --git a/src/pretix/presale/views/theme.py b/src/pretix/presale/views/theme.py index 341a1773fd..fe4f79c0ce 100644 --- a/src/pretix/presale/views/theme.py +++ b/src/pretix/presale/views/theme.py @@ -63,34 +63,6 @@ def browserconfig_xml(request): ) -@cache_page(3600) -def webmanifest(request): - return HttpResponse( - """{ - "name": "", - "short_name": "", - "icons": [ - { - "src": "%s", - "sizes": "192x192", - "type": "image/png" - }, - { - "src": "%s", - "sizes": "512x512", - "type": "image/png" - } - ], - "theme_color": "#3b1c4a", - "background_color": "#3b1c4a", - "display": "standalone" -}""" % ( - static('pretixbase/img/icons/android-chrome-192x192.png'), - static('pretixbase/img/icons/android-chrome-512x512.png'), - ), content_type='text/json' - ) - - @gzip_page @condition(etag_func=lambda request, **kwargs: request.GET.get("version")) def theme_css(request, **kwargs): diff --git a/src/pretix/urls.py b/src/pretix/urls.py index f557fc9abb..171574f4bf 100644 --- a/src/pretix/urls.py +++ b/src/pretix/urls.py @@ -43,6 +43,7 @@ from pretix.base.views import applepay, js_helpers from .base.views import ( cachedfiles, csp, health, js_catalog, metrics, redirect, source, + webmanifest, ) base_patterns = [ @@ -51,6 +52,7 @@ base_patterns = [ re_path(r'^healthcheck/$', health.healthcheck, name='healthcheck'), re_path(r'^redirect/$', redirect.redir_view, name='redirect'), + re_path(r'^site.webmanifest$', webmanifest.webmanifest, name='site.webmanifest'), re_path(r'^jsi18n/(?P[a-zA-Z-_]+)/$', js_catalog.js_catalog, name='javascript-catalog'), re_path(r'^metrics$', metrics.serve_metrics, name='metrics'),