Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into develop
This commit is contained in:
commit
5e37adedfb
5 changed files with 36 additions and 2 deletions
14
lib/pleroma/http/http.ex
Normal file
14
lib/pleroma/http/http.ex
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
|
||||
defmodule Pleroma.HTTP do
|
||||
use HTTPoison.Base
|
||||
|
||||
def process_request_options(options) do
|
||||
config = Application.get_env(:pleroma, :http, [])
|
||||
proxy = Keyword.get(config, :proxy_url, nil)
|
||||
case proxy do
|
||||
nil -> options
|
||||
_ -> options ++ [proxy: proxy]
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -2,6 +2,8 @@ defmodule Pleroma.Web.MediaProxy.MediaProxyController do
|
|||
use Pleroma.Web, :controller
|
||||
require Logger
|
||||
|
||||
@httpoison Application.get_env(:pleroma, :httpoison)
|
||||
|
||||
@max_body_length 25 * 1048576
|
||||
|
||||
@cache_control %{
|
||||
|
|
@ -29,7 +31,7 @@ defmodule Pleroma.Web.MediaProxy.MediaProxyController do
|
|||
|
||||
defp proxy_request(link) do
|
||||
headers = [{"user-agent", "Pleroma/MediaProxy; #{Pleroma.Web.base_url()} <#{Application.get_env(:pleroma, :instance)[:email]}>"}]
|
||||
options = [:insecure, {:follow_redirect, true}]
|
||||
options = @httpoison.process_request_options([:insecure, {:follow_redirect, true}])
|
||||
with \
|
||||
{:ok, 200, headers, client} <- :hackney.request(:get, link, headers, "", options),
|
||||
headers = Enum.into(headers, Map.new),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue