BTHLABS-0000: Use absolute URLs in ui.meta.manifest_json
This commit is contained in:
parent
6f848be1ee
commit
67138c7035
|
@ -12,24 +12,32 @@ def manifest_json(request: HttpRequest) -> JsonResponse:
|
|||
result = {
|
||||
'name': settings.SITE_TITLE,
|
||||
'short_name': settings.SITE_SHORT_TITLE,
|
||||
'start_url': reverse('ui.associations.browse'),
|
||||
'start_url': request.build_absolute_uri(
|
||||
reverse('ui.associations.browse'),
|
||||
),
|
||||
'display': 'standalone',
|
||||
'background_color': '#212529',
|
||||
'theme_color': '#2b3035',
|
||||
'icons': [
|
||||
{
|
||||
'src': static('ui/img/icon-192.png'),
|
||||
'src': request.build_absolute_uri(
|
||||
static('ui/img/icon-192.png'),
|
||||
),
|
||||
'sizes': '192x192',
|
||||
'type': 'image/png',
|
||||
},
|
||||
{
|
||||
'src': static('ui/img/icon-512.png'),
|
||||
'src': request.build_absolute_uri(
|
||||
static('ui/img/icon-512.png'),
|
||||
),
|
||||
'sizes': '512x512',
|
||||
'type': 'image/png',
|
||||
},
|
||||
],
|
||||
'share_target': {
|
||||
'action': reverse('ui.integrations.android.share_sheet'),
|
||||
'action': request.build_absolute_uri(
|
||||
reverse('ui.integrations.android.share_sheet'),
|
||||
),
|
||||
'method': 'POST',
|
||||
'enctype': 'multipart/form-data',
|
||||
'params': {
|
||||
|
|
0
services/backend/tests/ui/views/meta/__init__.py
Normal file
0
services/backend/tests/ui/views/meta/__init__.py
Normal file
24
services/backend/tests/ui/views/meta/test_manifest_json.py
Normal file
24
services/backend/tests/ui/views/meta/test_manifest_json.py
Normal file
|
@ -0,0 +1,24 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# type: ignore
|
||||
from __future__ import annotations
|
||||
|
||||
import http
|
||||
|
||||
from django.test import Client
|
||||
from django.urls import reverse
|
||||
|
||||
|
||||
def test_ok(client: Client, settings):
|
||||
# When
|
||||
result = client.get(reverse('ui.meta.manifest_json'))
|
||||
|
||||
# Then
|
||||
assert result.status_code == http.HTTPStatus.OK
|
||||
|
||||
payload = result.json()
|
||||
assert payload['name'] == settings.SITE_TITLE
|
||||
assert payload['short_name'] == settings.SITE_SHORT_TITLE
|
||||
assert payload['start_url'] == f"http://testserver{reverse('ui.associations.browse')}"
|
||||
assert payload['share_target']['action'] == (
|
||||
f"http://testserver{reverse('ui.integrations.android.share_sheet')}"
|
||||
)
|
Loading…
Reference in New Issue
Block a user