apply proxy settings to media_proxy

This commit is contained in:
Jeff Becker 2017-12-31 09:25:00 -05:00
parent 39854d6c11
commit 1e185b9301
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05
1 changed files with 3 additions and 1 deletions

View File

@ -2,6 +2,8 @@ defmodule Pleroma.Web.MediaProxy.MediaProxyController do
use Pleroma.Web, :controller use Pleroma.Web, :controller
require Logger require Logger
@httpoison Application.get_env(:pleroma, :httpoison)
@max_body_length 25 * 1048576 @max_body_length 25 * 1048576
@cache_control %{ @cache_control %{
@ -29,7 +31,7 @@ def remote(conn, %{"sig" => sig, "url" => url}) do
defp proxy_request(link) do defp proxy_request(link) do
headers = [{"user-agent", "Pleroma/MediaProxy; #{Pleroma.Web.base_url()} <#{Application.get_env(:pleroma, :instance)[:email]}>"}] 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 \ with \
{:ok, 200, headers, client} <- :hackney.request(:get, link, headers, "", options), {:ok, 200, headers, client} <- :hackney.request(:get, link, headers, "", options),
headers = Enum.into(headers, Map.new), headers = Enum.into(headers, Map.new),