Apply 4 suggestion(s) to 2 file(s)
This commit is contained in:
parent
e8bf060e6e
commit
fa63f1b55b
@ -237,13 +237,7 @@ def base_url do
|
||||
|
||||
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])
|
||||
@ -260,22 +254,14 @@ def base_url do
|
||||
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
|
||||
|
@ -80,13 +80,12 @@ def whitelisted?(url) do
|
||||
|> 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
|
||||
|
Loading…
Reference in New Issue
Block a user