forked from mirrors/akkoma
Merge branch 'feature/custom_media_url' into 'develop'
[Pleroma.Uploaders.Local]: Add configuration for custom url path See merge request pleroma/pleroma!318
This commit is contained in:
commit
3e4f39116b
2 changed files with 8 additions and 2 deletions
|
@ -14,7 +14,9 @@ config :pleroma, Pleroma.Upload,
|
||||||
uploader: Pleroma.Uploaders.Local,
|
uploader: Pleroma.Uploaders.Local,
|
||||||
strip_exif: false
|
strip_exif: false
|
||||||
|
|
||||||
config :pleroma, Pleroma.Uploaders.Local, uploads: "uploads"
|
config :pleroma, Pleroma.Uploaders.Local,
|
||||||
|
uploads: "uploads",
|
||||||
|
uploads_url: "{{base_url}}/media/{{file}}"
|
||||||
|
|
||||||
config :pleroma, Pleroma.Uploaders.S3,
|
config :pleroma, Pleroma.Uploaders.S3,
|
||||||
bucket: nil,
|
bucket: nil,
|
||||||
|
|
|
@ -42,6 +42,10 @@ defmodule Pleroma.Uploaders.Local do
|
||||||
end
|
end
|
||||||
|
|
||||||
defp url_for(file) do
|
defp url_for(file) do
|
||||||
"#{Web.base_url()}/media/#{file}"
|
settings = Application.get_env(:pleroma, Pleroma.Uploaders.Local)
|
||||||
|
|
||||||
|
Keyword.get(settings, :uploads_url)
|
||||||
|
|> String.replace("{{file}}", file)
|
||||||
|
|> String.replace("{{base_url}}", Web.base_url())
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue