Add an endpoint for deleting emoji packs
This commit is contained in:
parent
3a8669b487
commit
2d4b8f3d20
3 changed files with 21 additions and 1 deletions
|
|
@ -210,4 +210,16 @@ keeping it in cache for #{div(cache_ms, 1000)}s")
|
|||
conn |> put_status(:internal_server_error) |> text(e)
|
||||
end
|
||||
end
|
||||
|
||||
def delete(conn, %{"name" => name}) do
|
||||
pack_dir = Path.join(@emoji_dir_path, name)
|
||||
|
||||
case File.rm_rf(pack_dir) do
|
||||
{:ok, _} ->
|
||||
conn |> text("ok")
|
||||
|
||||
{:error, _} ->
|
||||
conn |> put_status(:internal_server_error) |> text("Couldn't delete the pack #{name}")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -218,6 +218,7 @@ defmodule Pleroma.Web.Router do
|
|||
# Modifying packs
|
||||
pipe_through([:admin_api, :oauth_write])
|
||||
|
||||
delete("/delete/:name", EmojiAPIController, :delete)
|
||||
post("/download_from", EmojiAPIController, :download_from)
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue