mirror of
https://github.com/pretix/pretix.git
synced 2026-05-09 15:54:03 +00:00
Add more favicons for browser shortcuts
This commit is contained in:
@@ -78,5 +78,6 @@ def contextprocessor(request):
|
||||
ctx['js_date_format'] = get_javascript_format_without_seconds('DATE_INPUT_FORMATS')
|
||||
ctx['js_time_format'] = get_javascript_format_without_seconds('TIME_INPUT_FORMATS')
|
||||
ctx['js_locale'] = get_moment_locale()
|
||||
ctx['settings'] = pretix_settings
|
||||
|
||||
return ctx
|
||||
|
||||
@@ -35,8 +35,18 @@
|
||||
<meta name="referrer" content="origin">
|
||||
{{ html_head|safe }}
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=0">
|
||||
<link rel="icon" href="{% static "pretixbase/img/favicon.ico" %}">
|
||||
{% block custom_header %}{% endblock %}
|
||||
<link rel="shortcut icon" href="{% static "pretixbase/img/favicon.ico" %}">
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="{% static "pretixbase/img/icons/apple-touch-icon.png" %}">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="{% static "pretixbase/img/icons/favicon-32x32.png" %}">
|
||||
<link rel="icon" type="image/png" sizes="194x194" href="{% static "pretixbase/img/icons/favicon-194x194.png" %}">
|
||||
<link rel="icon" type="image/png" sizes="192x192" href="{% static "pretixbase/img/icons/android-chrome-192x192.png" %}">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="{% static "pretixbase/img/icons/favicon-16x16.png" %}">
|
||||
<link rel="manifest" href="{% url "presale:site.webmanifest" %}">
|
||||
<link rel="mask-icon" href="{% static "pretixbase/img/icons/safari-pinned-tab.svg" %}" color="{{ settings.primary_color|default:"#3b1c4a" }}">
|
||||
<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" }}">
|
||||
</head>
|
||||
<body class="nojs" data-locale="{{ request.LANGUAGE_CODE }}" data-now="{% now "U.u" %}" data-datetimeformat="{{ js_datetime_format }}" data-timeformat="{{ js_time_format }}" data-dateformat="{{ js_date_format }}" data-datetimelocale="{{ js_locale }}">
|
||||
{% block above %}
|
||||
|
||||
@@ -8,6 +8,7 @@ import pretix.presale.views.locale
|
||||
import pretix.presale.views.order
|
||||
import pretix.presale.views.organizer
|
||||
import pretix.presale.views.robots
|
||||
import pretix.presale.views.theme
|
||||
import pretix.presale.views.user
|
||||
import pretix.presale.views.waiting
|
||||
import pretix.presale.views.widget
|
||||
@@ -111,5 +112,7 @@ organizer_patterns = [
|
||||
locale_patterns = [
|
||||
url(r'^locale/set$', pretix.presale.views.locale.LocaleSet.as_view(), name='locale.set'),
|
||||
url(r'^robots.txt$', pretix.presale.views.robots.robots_txt, name='robots.txt'),
|
||||
url(r'^browserconfig.xml$', pretix.presale.views.theme.browserconfig_xml, name='browserconfig.xml'),
|
||||
url(r'^site.webmanifest$', pretix.presale.views.theme.webmanifest, name='site.webmanifest'),
|
||||
url(r'^widget/v1\.(?P<lang>[a-zA-Z0-9_\-]+)\.js$', pretix.presale.views.widget.widget_js, name='widget.js'),
|
||||
]
|
||||
|
||||
50
src/pretix/presale/views/theme.py
Normal file
50
src/pretix/presale/views/theme.py
Normal file
@@ -0,0 +1,50 @@
|
||||
from django.http import HttpResponse
|
||||
from django.templatetags.static import static
|
||||
from django.views.decorators.cache import cache_page
|
||||
|
||||
|
||||
@cache_page(3600)
|
||||
def browserconfig_xml(request):
|
||||
return HttpResponse(
|
||||
"""<?xml version="1.0" encoding="utf-8"?>
|
||||
<browserconfig>
|
||||
<msapplication>
|
||||
<tile>
|
||||
<square150x150logo src="{}"/>
|
||||
<square310x310logo src="{}"/>
|
||||
<TileColor>#3b1c4a</TileColor>
|
||||
</tile>
|
||||
</msapplication>
|
||||
</browserconfig>""".format(
|
||||
static('pretixbase/img/icons/mstile-150x150.png'),
|
||||
static('pretixbase/img/icons/mstile-310x310.png'),
|
||||
), content_type='text/xml'
|
||||
)
|
||||
|
||||
|
||||
@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'
|
||||
)
|
||||
Reference in New Issue
Block a user