add mdii uploader

This commit is contained in:
Hakaba Hitoyo 2018-11-15 14:19:10 +09:00
parent 5c8b8f6cb7
commit 58af0787be
2 changed files with 22 additions and 0 deletions

View File

@ -23,6 +23,9 @@ config :pleroma, Pleroma.Uploaders.S3,
public_endpoint: "https://s3.amazonaws.com",
force_media_proxy: false
config :pleroma, Pleroma.Uploaders.Mdii,
host_name: "mdii.sakura.ne.jp"
config :pleroma, :emoji, shortcode_globs: ["/emoji/custom/**/*.png"]
config :pleroma, :uri_schemes,

View File

@ -0,0 +1,19 @@
defmodule Pleroma.Uploaders.Mdii do
@behaviour Pleroma.Uploaders.Uploader
def put_file(name, uuid, path, content_type, _should_dedupe) do
settings = Application.get_env(:pleroma, Pleroma.Uploaders.Mdii)
host_name = Keyword.fetch!(settings, :host_name)
{:ok, file_data} = File.read(path)
File.rm!(path)
remote_file_name = "00000"
extension = "png"
public_url = "https://#{host_name}/#{remote_file_name}.#{extension}"
{:ok, public_url}
end
end