-
Notifications
You must be signed in to change notification settings - Fork 300
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* 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>
- Loading branch information
1 parent
84f13dd
commit cd66dce
Showing
5 changed files
with
52 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
from .settings import * | ||
from .toasts import * | ||
from .health import health | ||
from .manifest import manifest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |