Extend the host-meta with extra fields and sort them by rel
This commit is contained in:
parent
a7f6824334
commit
85d95fb5d7
1 changed files with 19 additions and 11 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
from django.conf import settings
|
||||||
from django.http import HttpResponse, JsonResponse
|
from django.http import HttpResponse, JsonResponse
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from lemoncurry.utils import load_package_json, origin
|
from lemoncurry.utils import load_package_json, origin
|
||||||
|
@ -12,14 +13,22 @@ def add_links(request, dest):
|
||||||
license = 'https://creativecommons.org/licenses/by-sa/4.0/'
|
license = 'https://creativecommons.org/licenses/by-sa/4.0/'
|
||||||
|
|
||||||
links = (
|
links = (
|
||||||
|
Link(
|
||||||
|
href=urljoin(base, reverse('entries:atom')),
|
||||||
|
rel='alternate', type_='application/atom+xml',
|
||||||
|
),
|
||||||
|
Link(
|
||||||
|
href=urljoin(base, reverse('entries:rss')),
|
||||||
|
rel='alternate', type_='application/rss+xml',
|
||||||
|
),
|
||||||
Link(
|
Link(
|
||||||
href=urljoin(base, reverse('lemonauth:indie')),
|
href=urljoin(base, reverse('lemonauth:indie')),
|
||||||
rel='authorization_endpoint'
|
rel='authorization_endpoint'
|
||||||
),
|
),
|
||||||
Link(
|
Link(href=pkg['repository'], type_='text/html', rel='code-repository'),
|
||||||
href=urljoin(base, reverse('lemonauth:token')),
|
Link(href=settings.PUSH_HUB, rel='hub'),
|
||||||
rel='token_endpoint'
|
Link(href=license, type_='text/html', rel='license'),
|
||||||
),
|
Link(href=license+'rdf', type_='application/rdf+xml', rel='license'),
|
||||||
Link(
|
Link(
|
||||||
template=urljoin(base, webfinger),
|
template=urljoin(base, webfinger),
|
||||||
type_='application/json', rel='lrdd',
|
type_='application/json', rel='lrdd',
|
||||||
|
@ -29,16 +38,15 @@ def add_links(request, dest):
|
||||||
rel='manifest', type_='application/json',
|
rel='manifest', type_='application/json',
|
||||||
),
|
),
|
||||||
Link(
|
Link(
|
||||||
href=urljoin(base, reverse('entries:atom')),
|
href=urljoin(base, reverse('micropub:micropub')),
|
||||||
rel='alternate', type_='application/atom+xml',
|
rel='micropub'
|
||||||
),
|
),
|
||||||
Link(
|
Link(
|
||||||
href=urljoin(base, reverse('entries:rss')),
|
href=urljoin(base, reverse('lemonauth:token')),
|
||||||
rel='alternate', type_='application/rss+xml',
|
rel='token_endpoint'
|
||||||
),
|
),
|
||||||
Link(href=license, type_='text/html', rel='license'),
|
Link(href='https://openid.indieauth.com/openid', rel='openid.server'),
|
||||||
Link(href=license+'rdf', type_='application/rdf+xml', rel='license'),
|
Link(href=base, rel='openid.delegate'),
|
||||||
Link(href=pkg['repository'], type_='text/html', rel='code-repository'),
|
|
||||||
)
|
)
|
||||||
dest.extend(links)
|
dest.extend(links)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue