From: Hakaba Hitoyo Date: Thu, 15 Nov 2018 05:19:10 +0000 (+0900) Subject: add mdii uploader X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=58af0787be605d0b382b30aba3749c7c8bbf10bc;p=akkoma add mdii uploader --- diff --git a/config/config.exs b/config/config.exs index 9cc558564..ef69368e6 100644 --- a/config/config.exs +++ b/config/config.exs @@ -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, diff --git a/lib/pleroma/uploaders/mdii.ex b/lib/pleroma/uploaders/mdii.ex new file mode 100644 index 000000000..3cf71df43 --- /dev/null +++ b/lib/pleroma/uploaders/mdii.ex @@ -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