2018-12-23 13:04:54 -07:00
|
|
|
# Pleroma: A lightweight social networking server
|
2018-12-31 08:41:47 -07:00
|
|
|
# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
|
2018-12-23 13:04:54 -07:00
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2018-08-28 19:32:24 -06:00
|
|
|
defmodule Pleroma.Uploaders.Swift do
|
|
|
|
@behaviour Pleroma.Uploaders.Uploader
|
|
|
|
|
2018-11-23 09:40:45 -07:00
|
|
|
def get_file(name) do
|
|
|
|
{:ok, {:url, Path.join([Pleroma.Config.get!([__MODULE__, :object_url]), name])}}
|
|
|
|
end
|
|
|
|
|
2018-11-29 13:11:45 -07:00
|
|
|
def put_file(upload) do
|
|
|
|
Pleroma.Uploaders.Swift.Client.upload_file(
|
|
|
|
upload.path,
|
|
|
|
File.read!(upload.tmpfile),
|
|
|
|
upload.content_type
|
|
|
|
)
|
2018-08-28 19:32:24 -06:00
|
|
|
end
|
|
|
|
end
|