diff options
author | lain <lain@soykaf.club> | 2020-04-09 13:25:27 +0200 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-04-09 13:25:27 +0200 |
commit | d35e114acddf339ed398aeab02bf94abe229ac36 (patch) | |
tree | e35bbf60afa823fd1fdf2b0366249a31f040cd29 /lib/pleroma/web/mastodon_api/controllers/app_controller.ex | |
parent | 8e637ae1a7b75fa08679ae9cf424650fc105de85 (diff) | |
parent | b87b798ca1660224a3192c32b035c19b18e11587 (diff) | |
download | pleroma-d35e114acddf339ed398aeab02bf94abe229ac36.tar.gz |
Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into remake-remodel-dms
Diffstat (limited to 'lib/pleroma/web/mastodon_api/controllers/app_controller.ex')
-rw-r--r-- | lib/pleroma/web/mastodon_api/controllers/app_controller.ex | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/pleroma/web/mastodon_api/controllers/app_controller.ex b/lib/pleroma/web/mastodon_api/controllers/app_controller.ex index 5e2871f18..005c60444 100644 --- a/lib/pleroma/web/mastodon_api/controllers/app_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/app_controller.ex @@ -14,17 +14,20 @@ defmodule Pleroma.Web.MastodonAPI.AppController do action_fallback(Pleroma.Web.MastodonAPI.FallbackController) plug(OAuthScopesPlug, %{scopes: ["read"]} when action == :verify_credentials) + plug(OpenApiSpex.Plug.CastAndValidate) @local_mastodon_name "Mastodon-Local" + defdelegate open_api_operation(action), to: Pleroma.Web.ApiSpec.AppOperation + @doc "POST /api/v1/apps" - def create(conn, params) do + def create(%{body_params: params} = conn, _params) do scopes = Scopes.fetch_scopes(params, ["read"]) app_attrs = params - |> Map.drop(["scope", "scopes"]) - |> Map.put("scopes", scopes) + |> Map.take([:client_name, :redirect_uris, :website]) + |> Map.put(:scopes, scopes) with cs <- App.register_changeset(%App{}, app_attrs), false <- cs.changes[:client_name] == @local_mastodon_name, |