uploaded media plug: do not inject compile-time params on every request

This commit is contained in:
rinpatch 2020-03-13 22:12:33 +03:00
parent c6eb1c1b92
commit 6a28c198af
1 changed files with 4 additions and 5 deletions

View File

@ -18,7 +18,10 @@ defmodule Pleroma.Plugs.UploadedMedia do
def init(_opts) do def init(_opts) do
static_plug_opts = static_plug_opts =
[] [
headers: %{"cache-control" => @default_cache_control_header},
cache_control_for_etags: @default_cache_control_header
]
|> Keyword.put(:from, "__unconfigured_media_plug") |> Keyword.put(:from, "__unconfigured_media_plug")
|> Keyword.put(:at, "/__unconfigured_media_plug") |> Keyword.put(:at, "/__unconfigured_media_plug")
|> Plug.Static.init() |> Plug.Static.init()
@ -60,10 +63,6 @@ defp get_media(conn, {:static_dir, directory}, _, opts) do
Map.get(opts, :static_plug_opts) Map.get(opts, :static_plug_opts)
|> Map.put(:at, [@path]) |> Map.put(:at, [@path])
|> Map.put(:from, directory) |> Map.put(:from, directory)
|> Map.put(:cache_control_for_etags, @default_cache_control_header)
|> Map.put(:headers, %{
"cache-control" => @default_cache_control_header
})
conn = Plug.Static.call(conn, static_opts) conn = Plug.Static.call(conn, static_opts)