moved manifest to use main theming function

This commit is contained in:
vabene1111
2024-01-14 08:40:05 +08:00
parent 26408c33f4
commit 2ba2b97f9c
3 changed files with 40 additions and 40 deletions

View File

@ -31,6 +31,7 @@ from cookbook.helper.permission_helper import (group_required, has_group_permiss
from cookbook.models import (Comment, CookLog, InviteLink, SearchFields, SearchPreference,
ShareLink, Space, UserSpace, ViewLog)
from cookbook.tables import CookLogTable, ViewLogTable
from cookbook.templatetags.theming_tags import get_theming_values
from cookbook.version_info import VERSION_INFO
from recipes.settings import PLUGINS, BASE_DIR
@ -481,18 +482,13 @@ def report_share_abuse(request, token):
def web_manifest(request):
icons = [
{"src": static("/assets/logo_color.svg"), "sizes": "any"},
{"src": static("/assets/logo_color144.png"), "type": "image/png", "sizes": "144x144"},
{"src": static("/assets/logo_color512.png"), "type": "image/png", "sizes": "512x512"}
]
theme_values = get_theming_values(request)
if request.user.is_authenticated and getattr(request.space, 'logo_color_svg') and getattr(request.space, 'logo_color_144') and getattr(request.space, 'logo_color_512'):
icons = [
{"src": request.space.logo_color_svg.file.url, "sizes": "any"},
{"src": request.space.logo_color_144.file.url, "type": "image/png", "sizes": "144x144"},
{"src": request.space.logo_color_512.file.url, "type": "image/png", "sizes": "512x512"}
]
icons = [
{"src": theme_values['logo_color_svg'], "sizes": "any"},
{"src": theme_values['logo_color_144'], "type": "image/png", "sizes": "144x144"},
{"src": theme_values['logo_color_512'], "type": "image/png", "sizes": "512x512"}
]
manifest_info = {
"name": "Tandoor Recipes",
@ -500,10 +496,10 @@ def web_manifest(request):
"description": _("Manage recipes, shopping list, meal plans and more."),
"icons": icons,
"start_url": "./search",
"background_color": "#ffcb76",
"background_color": theme_values['nav_bg_color'],
"display": "standalone",
"scope": ".",
"theme_color": "#ffcb76",
"theme_color": theme_values['nav_bg_color'],
"shortcuts": [
{
"name": _("Plan"),