projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Revert "Merge branch 'streamer-refactoring' into 'develop'"
[akkoma]
/
lib
/
pleroma
/
uploaders
/
mdii.ex
diff --git
a/lib/pleroma/uploaders/mdii.ex
b/lib/pleroma/uploaders/mdii.ex
index 35d36d3e4e32065f7221fcc12f0c0ce43be74740..c36f3d61d9761cc1a02eb3f6b647fb1daa56b31c 100644
(file)
--- a/
lib/pleroma/uploaders/mdii.ex
+++ b/
lib/pleroma/uploaders/mdii.ex
@@
-1,10
+1,15
@@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
defmodule Pleroma.Uploaders.MDII do
defmodule Pleroma.Uploaders.MDII do
+ @moduledoc "Represents uploader for https://github.com/hakaba-hitoyo/minimal-digital-image-infrastructure"
+
alias Pleroma.Config
alias Pleroma.Config
+ alias Pleroma.HTTP
@behaviour Pleroma.Uploaders.Uploader
@behaviour Pleroma.Uploaders.Uploader
- @httpoison Application.get_env(:pleroma, :httpoison)
-
# MDII-hosted images are never passed through the MediaPlug; only local media.
# Delegate to Pleroma.Uploaders.Local
def get_file(file) do
# MDII-hosted images are never passed through the MediaPlug; only local media.
# Delegate to Pleroma.Uploaders.Local
def get_file(file) do
@@
-12,15
+17,16
@@
defmodule Pleroma.Uploaders.MDII do
end
def put_file(upload) do
end
def put_file(upload) do
- cgi =
Pleroma.
Config.get([Pleroma.Uploaders.MDII, :cgi])
- files =
Pleroma.
Config.get([Pleroma.Uploaders.MDII, :files])
+ cgi = Config.get([Pleroma.Uploaders.MDII, :cgi])
+ files = Config.get([Pleroma.Uploaders.MDII, :files])
{:ok, file_data} = File.read(upload.tempfile)
extension = String.split(upload.name, ".") |> List.last()
query = "#{cgi}?#{extension}"
{:ok, file_data} = File.read(upload.tempfile)
extension = String.split(upload.name, ".") |> List.last()
query = "#{cgi}?#{extension}"
- with {:ok, %{status_code: 200, body: body}} <- @httpoison.post(query, file_data) do
+ with {:ok, %{status: 200, body: body}} <-
+ HTTP.post(query, file_data, [], adapter: [pool: :default]) do
remote_file_name = String.split(body) |> List.first()
public_url = "#{files}/#{remote_file_name}.#{extension}"
{:ok, {:url, public_url}}
remote_file_name = String.split(body) |> List.first()
public_url = "#{files}/#{remote_file_name}.#{extension}"
{:ok, {:url, public_url}}