case uploader do
Pleroma.Uploaders.Local ->
- cond do
- !is_nil(upload_base_url) ->
- upload_base_url
-
- true ->
- Pleroma.Web.base_url() <> "/media/"
- end
+ upload_base_url || Pleroma.Web.base_url() <> "/media/"
Pleroma.Uploaders.S3 ->
bucket = Config.get([Pleroma.Uploaders.S3, :bucket])
bucket
end
- cond do
- !is_nil(public_endpoint) ->
- Path.join([public_endpoint, bucket_with_namespace])
-
- true ->
- Path.join([upload_base_url, bucket_with_namespace])
+ if public_endpoint do
+ Path.join([public_endpoint, bucket_with_namespace])
+ else
+ Path.join([upload_base_url, bucket_with_namespace])
end
_ ->
- cond do
- !is_nil(public_endpoint) ->
- public_endpoint
-
- true ->
- upload_base_url
- end
+ public_endpoint || upload_base_url
end
end
end
|> Enum.map(&maybe_get_domain_from_url/1)
whitelist_domains =
- cond do
- Web.base_url() == Upload.base_url() ->
- mediaproxy_whitelist_domains
-
- true ->
- %{host: base_domain} = URI.parse(Upload.base_url())
- [base_domain | mediaproxy_whitelist_domains]
+ base_url = Upload.base_url()
+ if Web.base_url() == base_url do
+ mediaproxy_whitelist_domains
+ else
+ %{host: base_domain} = URI.parse(base_url)
+ [base_domain | mediaproxy_whitelist_domains]
end
domain in whitelist_domains