forked from AkkomaGang/akkoma
apply proxy settings to media_proxy
This commit is contained in:
parent
39854d6c11
commit
1e185b9301
1 changed files with 3 additions and 1 deletions
|
@ -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),
|
||||||
|
|
Loading…
Reference in a new issue