add mdii uploader
This commit is contained in:
parent
5c8b8f6cb7
commit
58af0787be
@ -23,6 +23,9 @@ config :pleroma, Pleroma.Uploaders.S3,
|
|||||||
public_endpoint: "https://s3.amazonaws.com",
|
public_endpoint: "https://s3.amazonaws.com",
|
||||||
force_media_proxy: false
|
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, :emoji, shortcode_globs: ["/emoji/custom/**/*.png"]
|
||||||
|
|
||||||
config :pleroma, :uri_schemes,
|
config :pleroma, :uri_schemes,
|
||||||
|
19
lib/pleroma/uploaders/mdii.ex
Normal file
19
lib/pleroma/uploaders/mdii.ex
Normal 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
|
Loading…
Reference in New Issue
Block a user