mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-10 18:17:55 +00:00
2ff25ac0ce
apparently, all elixir openstack libraries are trash luckily, the APIs are stupid easy.
16 lines
483 B
Elixir
16 lines
483 B
Elixir
defmodule Pleroma.Uploaders.Swift do
|
|
@behaviour Pleroma.Uploaders.Uploader
|
|
|
|
@settings Application.get_env(:pleroma, Pleroma.Uploaders.Swift)
|
|
|
|
def put_file(name, uuid, tmp_path, content_type, _should_dedupe) do
|
|
{:ok, file_data} = File.read(tmp_path)
|
|
remote_name = "#{uuid}/#{name}"
|
|
|
|
Pleroma.Uploaders.Swift.Client.upload_file(remote_name, file_data, content_type)
|
|
|
|
object_url = Keyword.fetch!(@settings, :object_url)
|
|
"#{object_url}/#{remote_name}"
|
|
end
|
|
end
|