X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fplugs%2Finstance_static.ex;h=7516f75c38bd747f37823a44b8bba4544aed102c;hb=9cbf17d59fe34a760f8a4f94bc60f78b38ccba06;hp=af2f6f331bb0e478f50d699ee9e24ca2e575e841;hpb=ede3fd7459c437af19a736622e09d68d4b7acf61;p=akkoma
diff --git a/lib/pleroma/plugs/instance_static.ex b/lib/pleroma/plugs/instance_static.ex
index af2f6f331..7516f75c3 100644
--- a/lib/pleroma/plugs/instance_static.ex
+++ b/lib/pleroma/plugs/instance_static.ex
@@ -1,8 +1,10 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2019 Pleroma Authors
+# Copyright © 2017-2020 Pleroma Authors
# 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.
@@ -21,8 +23,6 @@ defmodule Pleroma.Plugs.InstanceStatic do
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")
@@ -30,10 +30,10 @@ defmodule Pleroma.Plugs.InstanceStatic do
|> 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,