Implement client capabilities endpoint

This commit is contained in:
Pim Kunis 2021-09-06 20:33:23 +02:00
parent 5f6476df57
commit 34da9da261
2 changed files with 22 additions and 0 deletions

View file

@ -21,4 +21,25 @@ defmodule ArchitexWeb.Client.InfoController do
def unrecognized(conn, _params) do def unrecognized(conn, _params) do
put_error(conn, :unrecognized) put_error(conn, :unrecognized)
end end
@doc """
Gets information about the server's supported feature set and other relevant capabilities.
Action for GET /_matrix/client/r0/capabilities.
"""
def capabilities(conn, _params) do
data = %{
capabilities: %{
"m.change_password": %{enabled: false},
"m.room_versions": %{
default: "5",
available: %{"5": "stable"}
}
}
}
conn
|> put_status(200)
|> json(data)
end
end end

View file

@ -53,6 +53,7 @@ defmodule ArchitexWeb.Router do
post "/logout/all", AccountController, :logout_all post "/logout/all", AccountController, :logout_all
post "/createRoom", RoomController, :create post "/createRoom", RoomController, :create
get "/joined_rooms", RoomController, :joined_rooms get "/joined_rooms", RoomController, :joined_rooms
get "/capabilities", InfoController, :capabilities
scope "/directory" do scope "/directory" do
put "/room/:alias", AliasesController, :create put "/room/:alias", AliasesController, :create