Add CORS headers

Implement versions endpoint
This commit is contained in:
Pim Kunis 2021-06-23 01:49:47 +02:00
parent 6e039524a4
commit 183120b5a1
6 changed files with 25 additions and 1 deletions

View 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

View file

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

View file

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