2023-05-23 19:20:58 +00:00
|
|
|
from django.http import JsonResponse
|
|
|
|
from django.conf import settings
|
|
|
|
|
|
|
|
|
|
|
|
def manifest(request):
|
|
|
|
response = {
|
|
|
|
"short_name": "linkding",
|
2024-03-16 14:20:22 +00:00
|
|
|
"name": "linkding",
|
|
|
|
"description": "Self-hosted bookmark service",
|
2023-05-23 19:20:58 +00:00
|
|
|
"start_url": "bookmarks",
|
|
|
|
"display": "standalone",
|
2024-01-27 10:29:16 +00:00
|
|
|
"scope": "/" + settings.LD_CONTEXT_PATH,
|
2024-03-16 14:20:22 +00:00
|
|
|
"theme_color": "#5856e0",
|
2024-03-24 10:50:02 +00:00
|
|
|
"background_color": (
|
|
|
|
"#161822" if request.user_profile.theme == "dark" else "#ffffff"
|
|
|
|
),
|
2024-03-16 14:20:22 +00:00
|
|
|
"icons": [
|
|
|
|
{
|
|
|
|
"src": "/" + settings.LD_CONTEXT_PATH + "static/logo.svg",
|
|
|
|
"type": "image/svg+xml",
|
|
|
|
"sizes": "512x512",
|
2024-03-24 10:50:02 +00:00
|
|
|
"purpose": "any",
|
2024-03-16 14:20:22 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"src": "/" + settings.LD_CONTEXT_PATH + "static/logo-512.png",
|
|
|
|
"type": "image/png",
|
|
|
|
"sizes": "512x512",
|
2024-03-24 10:50:02 +00:00
|
|
|
"purpose": "any",
|
2024-03-16 14:20:22 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"src": "/" + settings.LD_CONTEXT_PATH + "static/logo-192.png",
|
|
|
|
"type": "image/png",
|
|
|
|
"sizes": "192x192",
|
2024-03-24 10:50:02 +00:00
|
|
|
"purpose": "any",
|
2024-03-16 14:20:22 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"src": "/" + settings.LD_CONTEXT_PATH + "static/maskable-logo.svg",
|
|
|
|
"type": "image/svg+xml",
|
|
|
|
"sizes": "512x512",
|
2024-03-24 10:50:02 +00:00
|
|
|
"purpose": "maskable",
|
2024-03-16 14:20:22 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"src": "/" + settings.LD_CONTEXT_PATH + "static/maskable-logo-512.png",
|
|
|
|
"type": "image/png",
|
|
|
|
"sizes": "512x512",
|
2024-03-24 10:50:02 +00:00
|
|
|
"purpose": "maskable",
|
2024-03-16 14:20:22 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"src": "/" + settings.LD_CONTEXT_PATH + "static/maskable-logo-192.png",
|
|
|
|
"type": "image/png",
|
|
|
|
"sizes": "192x192",
|
2024-03-24 10:50:02 +00:00
|
|
|
"purpose": "maskable",
|
2024-03-16 14:20:22 +00:00
|
|
|
},
|
|
|
|
],
|
|
|
|
"shortcuts": [
|
|
|
|
{
|
|
|
|
"name": "Add bookmark",
|
|
|
|
"url": "/" + settings.LD_CONTEXT_PATH + "bookmarks/new",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "Archived",
|
|
|
|
"url": "/" + settings.LD_CONTEXT_PATH + "bookmarks/archived",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "Unread",
|
|
|
|
"url": "/" + settings.LD_CONTEXT_PATH + "bookmarks?unread=yes",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "Untagged",
|
|
|
|
"url": "/" + settings.LD_CONTEXT_PATH + "bookmarks?q=!untagged",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "Shared",
|
|
|
|
"url": "/" + settings.LD_CONTEXT_PATH + "bookmarks/shared",
|
2024-03-24 10:50:02 +00:00
|
|
|
},
|
2024-03-16 14:20:22 +00:00
|
|
|
],
|
|
|
|
"screenshots": [
|
|
|
|
{
|
2024-03-24 10:50:02 +00:00
|
|
|
"src": "/"
|
|
|
|
+ settings.LD_CONTEXT_PATH
|
|
|
|
+ "static/linkding-screenshot.png",
|
2024-03-16 14:20:22 +00:00
|
|
|
"type": "image/png",
|
|
|
|
"sizes": "2158x1160",
|
2024-03-24 10:50:02 +00:00
|
|
|
"form_factor": "wide",
|
2024-03-16 14:20:22 +00:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"share_target": {
|
|
|
|
"action": "/" + settings.LD_CONTEXT_PATH + "bookmarks/new",
|
|
|
|
"method": "GET",
|
|
|
|
"enctype": "application/x-www-form-urlencoded",
|
|
|
|
"params": {
|
|
|
|
"url": "url",
|
|
|
|
"text": "url",
|
|
|
|
"title": "title",
|
2024-03-24 10:50:02 +00:00
|
|
|
},
|
|
|
|
},
|
2023-05-23 19:20:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return JsonResponse(response, status=200)
|