Add CORS headers
Implement versions endpoint
This commit is contained in:
parent
6e039524a4
commit
183120b5a1
6 changed files with 25 additions and 1 deletions
13
lib/matrix_server_web/controllers/info_controller.ex
Normal file
13
lib/matrix_server_web/controllers/info_controller.ex
Normal file
|
@ -0,0 +1,13 @@
|
|||
defmodule MatrixServerWeb.InfoController do
|
||||
use MatrixServerWeb, :controller
|
||||
|
||||
@supported_versions ["r0.6.1"]
|
||||
|
||||
def versions(conn, _params) do
|
||||
data = %{versions: @supported_versions}
|
||||
|
||||
conn
|
||||
|> put_status(200)
|
||||
|> json(data)
|
||||
end
|
||||
end
|
|
@ -38,5 +38,7 @@ defmodule MatrixServerWeb.Endpoint do
|
|||
plug Plug.MethodOverride
|
||||
plug Plug.Head
|
||||
plug Plug.Session, @session_options
|
||||
plug CORSPlug
|
||||
|
||||
plug MatrixServerWeb.Router
|
||||
end
|
||||
|
|
|
@ -12,5 +12,7 @@ defmodule MatrixServerWeb.Router do
|
|||
post "/register", AccountController, :register
|
||||
get "/register/available", AccountController, :available
|
||||
end
|
||||
|
||||
get "/client/versions", InfoController, :versions
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue