1
0
Fork 1
mirror of https://akkoma.dev/AkkomaGang/akkoma.git synced 2024-11-18 10:59:17 +00:00
akkoma/lib/pleroma/web/uploader_controller.ex

26 lines
700 B
Elixir
Raw Normal View History

# Pleroma: A lightweight social networking server
2020-03-03 22:44:49 +00:00
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
2019-01-21 21:44:14 +00:00
defmodule Pleroma.Web.UploaderController do
use Pleroma.Web, :controller
alias Pleroma.Uploaders.Uploader
2019-02-03 17:44:18 +00:00
def callback(conn, %{"upload_path" => upload_path} = params) do
2019-01-21 21:44:14 +00:00
process_callback(conn, :global.whereis_name({Uploader, upload_path}), params)
end
defp process_callback(conn, pid, params) when is_pid(pid) do
send(pid, {Uploader, self(), conn, params})
receive do
{Uploader, conn} -> conn
end
end
defp process_callback(conn, _, _) do
render_error(conn, :bad_request, "bad request")
2019-01-21 21:44:14 +00:00
end
end