2021-06-22 12:09:25 +00:00
|
|
|
defmodule MatrixServerWeb.Router do
|
|
|
|
use MatrixServerWeb, :router
|
|
|
|
|
2021-06-25 23:14:09 +00:00
|
|
|
alias MatrixServerWeb.Plug.Authenticate
|
|
|
|
|
2021-06-25 22:29:33 +00:00
|
|
|
pipeline :public do
|
2021-06-22 12:09:25 +00:00
|
|
|
plug :accepts, ["json"]
|
|
|
|
end
|
|
|
|
|
2021-06-25 22:29:33 +00:00
|
|
|
pipeline :authenticated do
|
|
|
|
plug :accepts, ["json"]
|
2021-06-25 23:14:09 +00:00
|
|
|
plug Authenticate
|
2021-06-25 22:29:33 +00:00
|
|
|
end
|
|
|
|
|
2021-06-22 21:04:37 +00:00
|
|
|
scope "/_matrix", MatrixServerWeb do
|
2021-06-25 22:29:33 +00:00
|
|
|
pipe_through :public
|
2021-06-22 21:04:37 +00:00
|
|
|
|
2021-07-13 15:08:07 +00:00
|
|
|
scope "/client/r0" do
|
2021-06-25 15:43:12 +00:00
|
|
|
post "/register", AuthController, :register
|
2021-06-27 20:24:54 +00:00
|
|
|
get "/register/available", AccountController, :available
|
2021-06-26 20:02:18 +00:00
|
|
|
get "/login", AuthController, :login_types
|
|
|
|
post "/login", AuthController, :login
|
2021-06-22 21:04:37 +00:00
|
|
|
end
|
2021-06-22 23:49:47 +00:00
|
|
|
|
|
|
|
get "/client/versions", InfoController, :versions
|
2021-06-22 12:09:25 +00:00
|
|
|
end
|
2021-06-25 22:29:33 +00:00
|
|
|
|
|
|
|
scope "/_matrix", MatrixServerWeb do
|
|
|
|
pipe_through :authenticated
|
|
|
|
|
2021-07-13 15:08:07 +00:00
|
|
|
scope "/client/r0" do
|
2021-06-25 22:29:33 +00:00
|
|
|
get "/account/whoami", AccountController, :whoami
|
2021-06-27 20:24:54 +00:00
|
|
|
post "/logout", AccountController, :logout
|
|
|
|
post "/logout/all", AccountController, :logout_all
|
2021-07-10 21:16:00 +00:00
|
|
|
post "/createRoom", RoomController, :create
|
2021-07-30 13:56:24 +00:00
|
|
|
|
|
|
|
scope "/directory/room" do
|
|
|
|
put "/:alias", AliasesController, :create
|
|
|
|
end
|
2021-06-25 22:29:33 +00:00
|
|
|
end
|
|
|
|
end
|
2021-06-26 20:02:18 +00:00
|
|
|
|
|
|
|
scope "/", MatrixServerWeb do
|
|
|
|
match :*, "/*path", InfoController, :unrecognized
|
|
|
|
end
|
2021-06-22 12:09:25 +00:00
|
|
|
end
|