mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-14 05:04:49 +00:00
Fix media proxy config defaults
This commit is contained in:
parent
ca24ad2a2b
commit
43d5e4f7fa
1 changed files with 2 additions and 2 deletions
|
@ -5,12 +5,12 @@ defmodule Pleroma.Web.MediaProxy.MediaProxyController do
|
||||||
@default_proxy_opts [max_body_length: 25 * 1_048_576]
|
@default_proxy_opts [max_body_length: 25 * 1_048_576]
|
||||||
|
|
||||||
def remote(conn, params = %{"sig" => sig64, "url" => url64}) do
|
def remote(conn, params = %{"sig" => sig64, "url" => url64}) do
|
||||||
with config <- Pleroma.Config.get([:media_proxy]),
|
with config <- Pleroma.Config.get([:media_proxy], []),
|
||||||
true <- Keyword.get(config, :enabled, false),
|
true <- Keyword.get(config, :enabled, false),
|
||||||
{:ok, url} <- MediaProxy.decode_url(sig64, url64),
|
{:ok, url} <- MediaProxy.decode_url(sig64, url64),
|
||||||
filename <- Path.basename(URI.parse(url).path),
|
filename <- Path.basename(URI.parse(url).path),
|
||||||
:ok <- filename_matches(Map.has_key?(params, "filename"), conn.request_path, url) do
|
:ok <- filename_matches(Map.has_key?(params, "filename"), conn.request_path, url) do
|
||||||
ReverseProxy.call(conn, url, Keyword.get(config, :proxy_opts, @default_proxy_length))
|
ReverseProxy.call(conn, url, Keyword.get(config, :proxy_opts, @default_proxy_opts))
|
||||||
else
|
else
|
||||||
false ->
|
false ->
|
||||||
send_resp(conn, 404, Plug.Conn.Status.reason_phrase(404))
|
send_resp(conn, 404, Plug.Conn.Status.reason_phrase(404))
|
||||||
|
|
Loading…
Reference in a new issue