diff --git a/lemoncurry/templates/lemoncurry/layout.html b/lemoncurry/templates/lemoncurry/layout.html
index 1584152..c2bff64 100644
--- a/lemoncurry/templates/lemoncurry/layout.html
+++ b/lemoncurry/templates/lemoncurry/layout.html
@@ -1,4 +1,4 @@
-{% load compress favtags lemoncurry_tags meta static %}
+{% load compress favtags lemoncurry_tags meta static theme_colour %}
{% site_name as site_name %}{% request_uri request as uri %}{% request_origin request as origin %}
@@ -9,7 +9,9 @@
+
+
diff --git a/lemoncurry/templatetags/theme_colour.py b/lemoncurry/templatetags/theme_colour.py
new file mode 100644
index 0000000..1bd386b
--- /dev/null
+++ b/lemoncurry/templatetags/theme_colour.py
@@ -0,0 +1,9 @@
+from django import template
+from ..theme import color
+
+register = template.Library()
+
+
+@register.simple_tag
+def theme_colour(i):
+ return color(i)
diff --git a/lemoncurry/theme.py b/lemoncurry/theme.py
index fe87aac..b282e13 100644
--- a/lemoncurry/theme.py
+++ b/lemoncurry/theme.py
@@ -9,3 +9,7 @@ path = join(
)
with open(path, 'r') as f:
theme = safe_load(f)
+
+
+def color(i):
+ return '#' + theme['base0' + format(i, '1X')]
diff --git a/wellknowns/views/manifest.py b/wellknowns/views/manifest.py
index cc55f28..e9acd7d 100644
--- a/wellknowns/views/manifest.py
+++ b/wellknowns/views/manifest.py
@@ -1,17 +1,27 @@
from django.conf import settings
from django.http import JsonResponse
+from django.urls import reverse
from favicon.models import FaviconImg
from lemoncurry import utils
-from lemoncurry.theme import theme
+from lemoncurry.theme import color
from urllib.parse import urljoin
+from textwrap import shorten
def manifest(request):
- origin = utils.origin(request)
+ base = utils.origin(request)
+ name = settings.LEMONCURRY_SITE_NAME
+ start_url = reverse('home:index') + '?utm_source=homescreen'
+
app = {
- 'name': settings.LEMONCURRY_SITE_NAME,
- 'background_color': '#' + theme['base00'],
- 'theme_color': '#' + theme['base02'],
+ 'name': name,
+ 'short_name': shorten(name, width=20, placeholder=''),
+
+ 'display': 'browser',
+ 'start_url': urljoin(base, start_url),
+
+ 'background_color': color(0),
+ 'theme_color': color(2),
}
rels = ('shortcut icon', 'apple-touch-icon')
@@ -21,8 +31,8 @@ def manifest(request):
).order_by('size')
app['icons'] = [{
'type': 'image/png',
- 'size': '{0}x{0}'.format(icon.size),
- 'src': urljoin(origin, icon.faviconImage.url),
+ 'sizes': '{0}x{0}'.format(icon.size),
+ 'src': urljoin(base, icon.faviconImage.url),
} for icon in icons]
return JsonResponse(app, content_type='application/manifest+json')