diff --git a/lib/pleroma/web/api_spec/operations/pleroma_emoji_pack_operation.ex b/lib/pleroma/web/api_spec/operations/pleroma_emoji_pack_operation.ex index efa36ffdc..1c2b2c2b7 100644 --- a/lib/pleroma/web/api_spec/operations/pleroma_emoji_pack_operation.ex +++ b/lib/pleroma/web/api_spec/operations/pleroma_emoji_pack_operation.ex @@ -130,15 +130,15 @@ defmodule Pleroma.Web.ApiSpec.PleromaEmojiPackOperation do defp download_request do %Schema{ type: :object, - required: [:url, :name], + required: ["url", "name"], properties: %{ - url: %Schema{ + "url" => %Schema{ type: :string, format: :uri, description: "URL of the instance to download from" }, - name: %Schema{type: :string, format: :uri, description: "Pack Name"}, - as: %Schema{type: :string, format: :uri, description: "Save as"} + "name" => %Schema{type: :string, format: :uri, description: "Pack Name"}, + "as" => %Schema{type: :string, format: :uri, description: "Save as"} } } end @@ -302,27 +302,7 @@ defmodule Pleroma.Web.ApiSpec.PleromaEmojiPackOperation do defp update_request do %Schema{ type: :object, - properties: %{ - metadata: %Schema{ - type: :object, - description: "Metadata to replace the old one", - properties: %{ - license: %Schema{type: :string}, - homepage: %Schema{type: :string, format: :uri}, - description: %Schema{type: :string}, - "fallback-src": %Schema{ - type: :string, - format: :uri, - description: "Fallback url to download pack from" - }, - "fallback-src-sha256": %Schema{ - type: :string, - description: "SHA256 encoded for fallback pack archive" - }, - "share-files": %Schema{type: :boolean, description: "Is pack allowed for sharing?"} - } - } - } + properties: %{"metadata" => metadata()} } end diff --git a/lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex b/lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex index 420fea12c..64fd95759 100644 --- a/lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex +++ b/lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex @@ -109,8 +109,8 @@ defmodule Pleroma.Web.PleromaAPI.EmojiPackController do end end - def download(%{body_params: %{url: url, name: name} = params} = conn, _) do - with {:ok, _pack} <- Pack.download(name, url, params[:as]) do + def download(%{body_params: %{"url" => url, "name" => name} = params} = conn, _) do + with {:ok, _pack} <- Pack.download(name, url, params["as"]) do json(conn, "ok") else {:error, :not_shareable} -> @@ -184,7 +184,7 @@ defmodule Pleroma.Web.PleromaAPI.EmojiPackController do end end - def update(%{body_params: %{metadata: metadata}} = conn, %{name: name}) do + def update(%{body_params: %{"metadata" => metadata}} = conn, %{name: name}) do with {:ok, pack} <- Pack.update_metadata(name, metadata) do json(conn, pack.pack) else