Add matrix client well-known view
This commit is contained in:
parent
31c370c13e
commit
e74dbcc228
4 changed files with 26 additions and 0 deletions
5
website/common/templates/matrix-client.json
Normal file
5
website/common/templates/matrix-client.json
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"m.homeserver": {
|
||||
"base_url": "https://matrix.jakehoward.tech"
|
||||
}
|
||||
}
|
|
@ -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")
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"),
|
||||
]
|
||||
|
||||
|
|
Loading…
Reference in a new issue