diff options
author | Lain Soykaf <lain@soykaf.club> | 2020-08-19 21:29:03 +0200 |
---|---|---|
committer | Lain Soykaf <lain@soykaf.club> | 2020-08-19 21:29:03 +0200 |
commit | 8f882fd658843651c53d425d44c20d57aeef5f34 (patch) | |
tree | 5af069a13223621aa52f543ec1122c058f61b882 | |
parent | 5c2b6922e1463fe7c22149a92cd5749cb5b41505 (diff) | |
download | pleroma-8f882fd658843651c53d425d44c20d57aeef5f34.tar.gz |
.
-rw-r--r-- | lib/pleroma/web/matrix_controller.ex | 40 | ||||
-rw-r--r-- | lib/pleroma/web/router.ex | 6 |
2 files changed, 46 insertions, 0 deletions
diff --git a/lib/pleroma/web/matrix_controller.ex b/lib/pleroma/web/matrix_controller.ex new file mode 100644 index 000000000..86d58bfa5 --- /dev/null +++ b/lib/pleroma/web/matrix_controller.ex @@ -0,0 +1,40 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Web.MatrixController do + use Pleroma.Web, :controller + + def client_versions(conn, _) do + data = %{ + versions: ["r0.0.1", "r0.1.0", "r0.2.0", "r0.3.0", "r0.4.0", "r0.5.0"] + } + + conn + |> json(data) + end + + def login_info(conn, _) do + data = %{ + flows: [ + %{type: "m.login.password"} + ] + } + + conn + |> json(data) + end + + def login(conn, params) do + IO.inspect(params) + + data = %{ + errcode: "M_FORBIDDEN", + error: "Invalid password" + } + + conn + |> put_status(403) + |> json(data) + end +end diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex index c6433cc53..dc0641881 100644 --- a/lib/pleroma/web/router.ex +++ b/lib/pleroma/web/router.ex @@ -710,6 +710,12 @@ defmodule Pleroma.Web.Router do end end + scope "/_matrix", Pleroma.Web do + get("/client/versions", MatrixController, :client_versions) + get("/client/r0/login", MatrixController, :login_info) + post("/client/r0/login", MatrixController, :login) + end + scope "/", Pleroma.Web.MongooseIM do get("/user_exists", MongooseIMController, :user_exists) get("/check_password", MongooseIMController, :check_password) |