+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
defmodule Pleroma.Plugs.InstanceStatic do
+ require Pleroma.Constants
+
@moduledoc """
This is a shim to call `Plug.Static` but with runtime `from` configuration.
end
end
- @only ~w(index.html static emoji packs sounds images instance favicon.png)
-
def init(opts) do
opts
|> Keyword.put(:from, "__unconfigured_instance_static_plug")
|> Plug.Static.init()
end
- for only <- @only do
+ for only <- Pleroma.Constants.static_only_files() do
at = Plug.Router.Utils.split("/")
- def call(conn = %{request_path: "/" <> unquote(only) <> _}, opts) do
+ def call(%{request_path: "/" <> unquote(only) <> _} = conn, opts) do
call_static(
conn,
opts,