diff --git a/bookwyrm/templates/host_meta.xml b/bookwyrm/templates/host_meta.xml new file mode 100644 index 00000000..4fe8bcec --- /dev/null +++ b/bookwyrm/templates/host_meta.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/bookwyrm/urls.py b/bookwyrm/urls.py index f5c13a4b..5d8bc5e9 100644 --- a/bookwyrm/urls.py +++ b/bookwyrm/urls.py @@ -35,8 +35,9 @@ urlpatterns = [ re_path(r"^inbox/?$", views.Inbox.as_view()), re_path(r"%s/inbox/?$" % local_user_path, views.Inbox.as_view()), re_path(r"%s/outbox/?$" % local_user_path, views.Outbox.as_view()), - re_path(r"^.well-known/webfinger/?$", views.webfinger), - re_path(r"^.well-known/nodeinfo/?$", views.nodeinfo_pointer), + re_path(r"^\.well-known/webfinger/?$", views.webfinger), + re_path(r"^\.well-known/nodeinfo/?$", views.nodeinfo_pointer), + re_path(r"^\.well-known/host-meta/?$", views.host_meta), re_path(r"^nodeinfo/2\.0/?$", views.nodeinfo), re_path(r"^api/v1/instance/?$", views.instance_info), re_path(r"^api/v1/instance/peers/?$", views.peers), diff --git a/bookwyrm/views/__init__.py b/bookwyrm/views/__init__.py index 6ec79c1c..dc71d359 100644 --- a/bookwyrm/views/__init__.py +++ b/bookwyrm/views/__init__.py @@ -36,4 +36,4 @@ from .tag import Tag, AddTag, RemoveTag from .updates import get_notification_count, get_unread_status_count from .user import User, EditUser, Followers, Following from .user_admin import UserAdmin -from .wellknown import webfinger, nodeinfo_pointer, nodeinfo, instance_info, peers +from .wellknown import * diff --git a/bookwyrm/views/wellknown.py b/bookwyrm/views/wellknown.py index 127c7491..178d558e 100644 --- a/bookwyrm/views/wellknown.py +++ b/bookwyrm/views/wellknown.py @@ -3,6 +3,7 @@ from dateutil.relativedelta import relativedelta from django.http import HttpResponseNotFound from django.http import JsonResponse +from django.template.response import TemplateResponse from django.utils import timezone from django.views.decorators.http import require_GET @@ -118,3 +119,9 @@ def peers(_): """ list of federated servers this instance connects with """ names = models.FederatedServer.objects.values_list("server_name", flat=True) return JsonResponse(list(names), safe=False) + + +@require_GET +def host_meta(request): + """ meta of the host """ + return TemplateResponse(request, "host_meta.xml", {"DOMAIN": DOMAIN})