mirror of
https://github.com/pretix/pretix.git
synced 2025-12-07 22:42:26 +00:00
Compare commits
2 Commits
update-dja
...
presale-re
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
75b9d5e393 | ||
|
|
1aa386bde9 |
52
src/pretix/base/views/webmanifest.py
Normal file
52
src/pretix/base/views/webmanifest.py
Normal file
@@ -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 <https://pretix.eu/about/en/license>.
|
||||
#
|
||||
# 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
|
||||
# <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
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'
|
||||
)
|
||||
@@ -20,7 +20,7 @@
|
||||
{% endif %}
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="{% static "pretixbase/img/icons/apple-touch-icon.png" %}">
|
||||
<link rel="icon" type="image/png" sizes="192x192" href="{% static "pretixbase/img/icons/android-chrome-192x192.png" %}">
|
||||
<link rel="manifest" href="{% url "presale:site.webmanifest" %}">
|
||||
<link rel="manifest" href="{% url "site.webmanifest" %}">
|
||||
<link rel="mask-icon" href="{% static "pretixbase/img/icons/safari-pinned-tab.svg" %}" color="#3b1c4a">
|
||||
<meta name="msapplication-TileColor" content="#3b1c4a">
|
||||
<meta name="msapplication-config" content="{% url "presale:browserconfig.xml" %}">
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
{% endif %}
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="{% static "pretixbase/img/icons/apple-touch-icon.png" %}">
|
||||
<link rel="icon" type="image/png" sizes="192x192" href="{% static "pretixbase/img/icons/android-chrome-192x192.png" %}">
|
||||
<link rel="manifest" href="{% url "presale:site.webmanifest" %}">
|
||||
<link rel="manifest" href="{% url "site.webmanifest" %}">
|
||||
<link rel="mask-icon" href="{% static "pretixbase/img/icons/safari-pinned-tab.svg" %}" color="#3b1c4a">
|
||||
<meta name="msapplication-TileColor" content="#3b1c4a">
|
||||
<meta name="msapplication-config" content="{% url "presale:browserconfig.xml" %}">
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
<link rel="icon" type="image/png" sizes="192x192" href="{% static "pretixbase/img/icons/android-chrome-192x192.png" %}">
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="{% static "pretixbase/img/icons/apple-touch-icon.png" %}">
|
||||
{% endif %}
|
||||
<link rel="manifest" href="{% url "presale:site.webmanifest" %}">
|
||||
<meta name="msapplication-TileColor" content="{{ settings.primary_color|default:"#3b1c4a" }}">
|
||||
<meta name="msapplication-config" content="{% url "presale:browserconfig.xml" %}">
|
||||
<meta name="theme-color" content="{{ settings.primary_color|default:"#3b1c4a" }}">
|
||||
|
||||
@@ -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<int:version>.<slug:lang>.js', pretix.presale.views.widget.widget_js, name='widget.js'),
|
||||
]
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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<lang>[a-zA-Z-_]+)/$', js_catalog.js_catalog, name='javascript-catalog'),
|
||||
re_path(r'^metrics$', metrics.serve_metrics,
|
||||
name='metrics'),
|
||||
|
||||
Reference in New Issue
Block a user