diff --git a/website/common/templates/matrix-client.json b/website/common/templates/matrix-client.json new file mode 100644 index 0000000..d0af71b --- /dev/null +++ b/website/common/templates/matrix-client.json @@ -0,0 +1,5 @@ +{ + "m.homeserver": { + "base_url": "https://matrix.jakehoward.tech" + } +} diff --git a/website/common/tests/test_views.py b/website/common/tests/test_views.py index c7faa01..6ef75b8 100644 --- a/website/common/tests/test_views.py +++ b/website/common/tests/test_views.py @@ -59,3 +59,13 @@ class MatrixServerViewTestCase(SimpleTestCase): self.assertEqual(response.status_code, 200) self.assertEqual(response["Content-Type"], "application/json") self.assertTemplateUsed(response, "matrix-server.json") + + +class MatrixClientViewTestCase(SimpleTestCase): + url = reverse("matrix-client") + + def test_accessible(self) -> None: + response = self.client.get(self.url) + self.assertEqual(response.status_code, 200) + self.assertEqual(response["Content-Type"], "application/json") + self.assertTemplateUsed(response, "matrix-client.json") diff --git a/website/common/views.py b/website/common/views.py index ba047ad..609c42a 100644 --- a/website/common/views.py +++ b/website/common/views.py @@ -59,3 +59,8 @@ class SecurityView(TemplateView): class MatrixServerView(TemplateView): template_name = "matrix-server.json" content_type = "application/json" + + +class MatrixClientView(TemplateView): + template_name = "matrix-client.json" + content_type = "application/json" diff --git a/website/urls.py b/website/urls.py index 22cdabc..a5d873c 100644 --- a/website/urls.py +++ b/website/urls.py @@ -8,6 +8,7 @@ from wagtail.documents import urls as wagtaildocs_urls from wagtail.images.views.serve import ServeView from website.common.views import ( + MatrixClientView, MatrixServerView, RobotsView, SecurityView, @@ -38,6 +39,11 @@ urlpatterns = [ cache_page(60 * 60)(MatrixServerView.as_view()), name="matrix-server", ), + path( + ".well-known/matrix/client", + cache_page(60 * 60)(MatrixClientView.as_view()), + name="matrix-client", + ), path("404/", page_not_found, name="404"), ]