mirror of
https://github.com/sissbruecker/linkding.git
synced 2025-08-08 03:08:29 +02:00
* Added Apple web-app meta tag #358 * Added manifest file for web app * Changed manifest to use template #358 * Small tweaks, add tests --------- Co-authored-by: Sascha Ißbrücker <sascha.issbruecker@gmail.com>
This commit is contained in:
@@ -8,6 +8,8 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<link rel="icon" href="{% static 'favicon.png' %}"/>
|
<link rel="icon" href="{% static 'favicon.png' %}"/>
|
||||||
<link rel="apple-touch-icon" href="{% static 'apple-touch-icon.png' %}">
|
<link rel="apple-touch-icon" href="{% static 'apple-touch-icon.png' %}">
|
||||||
|
<link rel="manifest" href="{% url 'bookmarks:manifest' %}">
|
||||||
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimal-ui">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimal-ui">
|
||||||
<meta name="description" content="Self-hosted bookmark service">
|
<meta name="description" content="Self-hosted bookmark service">
|
||||||
<meta name="robots" content="index,follow">
|
<meta name="robots" content="index,follow">
|
||||||
|
33
bookmarks/tests/test_metadata_view.py
Normal file
33
bookmarks/tests/test_metadata_view.py
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
from django.test import TestCase, override_settings
|
||||||
|
|
||||||
|
|
||||||
|
class MetadataViewTestCase(TestCase):
|
||||||
|
|
||||||
|
def test_default_manifest(self):
|
||||||
|
response = self.client.get("/manifest.json")
|
||||||
|
|
||||||
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
||||||
|
response_body = response.json()
|
||||||
|
expected_body = {
|
||||||
|
"short_name": "linkding",
|
||||||
|
"start_url": "bookmarks",
|
||||||
|
"display": "standalone",
|
||||||
|
"scope": "/"
|
||||||
|
}
|
||||||
|
self.assertDictEqual(response_body, expected_body)
|
||||||
|
|
||||||
|
@override_settings(LD_CONTEXT_PATH="linkding/")
|
||||||
|
def test_manifest_respects_context_path(self):
|
||||||
|
response = self.client.get("/manifest.json")
|
||||||
|
|
||||||
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
||||||
|
response_body = response.json()
|
||||||
|
expected_body = {
|
||||||
|
"short_name": "linkding",
|
||||||
|
"start_url": "bookmarks",
|
||||||
|
"display": "standalone",
|
||||||
|
"scope": "/linkding/"
|
||||||
|
}
|
||||||
|
self.assertDictEqual(response_body, expected_body)
|
@@ -32,5 +32,7 @@ urlpatterns = [
|
|||||||
path('feeds/<str:feed_key>/all', AllBookmarksFeed(), name='feeds.all'),
|
path('feeds/<str:feed_key>/all', AllBookmarksFeed(), name='feeds.all'),
|
||||||
path('feeds/<str:feed_key>/unread', UnreadBookmarksFeed(), name='feeds.unread'),
|
path('feeds/<str:feed_key>/unread', UnreadBookmarksFeed(), name='feeds.unread'),
|
||||||
# Health check
|
# Health check
|
||||||
path('health', views.health, name='health')
|
path('health', views.health, name='health'),
|
||||||
|
# Manifest
|
||||||
|
path("manifest.json", views.manifest, name='manifest')
|
||||||
]
|
]
|
||||||
|
@@ -2,3 +2,4 @@ from .bookmarks import *
|
|||||||
from .settings import *
|
from .settings import *
|
||||||
from .toasts import *
|
from .toasts import *
|
||||||
from .health import health
|
from .health import health
|
||||||
|
from .manifest import manifest
|
||||||
|
13
bookmarks/views/manifest.py
Normal file
13
bookmarks/views/manifest.py
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
from django.http import JsonResponse
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
|
|
||||||
|
def manifest(request):
|
||||||
|
response = {
|
||||||
|
"short_name": "linkding",
|
||||||
|
"start_url": "bookmarks",
|
||||||
|
"display": "standalone",
|
||||||
|
"scope": "/" + settings.LD_CONTEXT_PATH
|
||||||
|
}
|
||||||
|
|
||||||
|
return JsonResponse(response, status=200)
|
Reference in New Issue
Block a user