pack routes change
This commit is contained in:
parent
958008cc14
commit
8c6ec4c111
4 changed files with 97 additions and 83 deletions
|
|
@ -245,7 +245,7 @@ defmodule Pleroma.Emoji.Pack do
|
|||
|
||||
with :ok <- validate_shareable_packs_available(uri),
|
||||
{:ok, remote_pack} <-
|
||||
uri |> URI.merge("/api/pleroma/emoji/packs/show?name=#{name}") |> http_get(),
|
||||
uri |> URI.merge("/api/pleroma/emoji/pack?name=#{name}") |> http_get(),
|
||||
{:ok, %{sha: sha, url: url} = pack_info} <- fetch_pack_info(remote_pack, uri, name),
|
||||
{:ok, archive} <- download_archive(url, sha),
|
||||
pack <- copy_as(remote_pack, as || name),
|
||||
|
|
@ -524,7 +524,7 @@ defmodule Pleroma.Emoji.Pack do
|
|||
defp http_get(%URI{} = url), do: url |> to_string() |> http_get()
|
||||
|
||||
defp http_get(url) do
|
||||
with {:ok, %{body: body}} <- url |> Pleroma.HTTP.get() do
|
||||
with {:ok, %{body: body}} <- Pleroma.HTTP.get(url, [], pool: :default) do
|
||||
Jason.decode(body)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -226,6 +226,20 @@ defmodule Pleroma.Web.Router do
|
|||
end
|
||||
|
||||
scope "/api/pleroma/emoji", Pleroma.Web.PleromaAPI do
|
||||
scope "/pack" do
|
||||
pipe_through(:admin_api)
|
||||
|
||||
post("/", EmojiPackController, :create)
|
||||
patch("/", EmojiPackController, :update)
|
||||
delete("/", EmojiPackController, :delete)
|
||||
end
|
||||
|
||||
scope "/pack" do
|
||||
pipe_through(:api)
|
||||
|
||||
get("/", EmojiPackController, :show)
|
||||
end
|
||||
|
||||
# Modifying packs
|
||||
scope "/packs" do
|
||||
pipe_through(:admin_api)
|
||||
|
|
@ -246,8 +260,8 @@ defmodule Pleroma.Web.Router do
|
|||
# Pack info / downloading
|
||||
scope "/packs" do
|
||||
pipe_through(:api)
|
||||
|
||||
get("/", EmojiPackController, :index)
|
||||
get("/show", EmojiPackController, :show)
|
||||
get("/archive", EmojiPackController, :archive)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue