Adds hosts-meta path

This commit is contained in:
Mouse Reeve 2021-03-29 14:36:24 -07:00
parent 4115edad6e
commit 6bf3d9dcd8
4 changed files with 16 additions and 3 deletions

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0">
<Link rel="lrdd" template="https://{{ DOMAIN }}/.well-known/webfinger?resource={uri}"/>
</XRD>

View file

@ -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),

View file

@ -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 *

View file

@ -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})