aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/web/plugs/frontend_static.ex
diff options
context:
space:
mode:
authorfeld <feld@feld.me>2021-06-07 20:06:36 +0000
committerfeld <feld@feld.me>2021-06-07 20:06:36 +0000
commit84f42b92f0f53c569d0f7628d0a4af3ee5c06eaa (patch)
tree80664a6152e92abb37133fede9e3ed72c6801910 /lib/pleroma/web/plugs/frontend_static.ex
parent4ca380490f1e42ef6b12c4b12ba9efabb89472fd (diff)
parent64bc0c69ed6b77283905b04585f03c23cbedbe03 (diff)
downloadpleroma-84f42b92f0f53c569d0f7628d0a4af3ee5c06eaa.tar.gz
Merge branch 'develop' into 'fix/prune-hashtags'
# Conflicts: # CHANGELOG.md
Diffstat (limited to 'lib/pleroma/web/plugs/frontend_static.ex')
-rw-r--r--lib/pleroma/web/plugs/frontend_static.ex9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/pleroma/web/plugs/frontend_static.ex b/lib/pleroma/web/plugs/frontend_static.ex
index eb385e94d..ebe7eaf86 100644
--- a/lib/pleroma/web/plugs/frontend_static.ex
+++ b/lib/pleroma/web/plugs/frontend_static.ex
@@ -10,8 +10,6 @@ defmodule Pleroma.Web.Plugs.FrontendStatic do
"""
@behaviour Plug
- @api_routes Pleroma.Web.get_api_routes()
-
def file_path(path, frontend_type \\ :primary) do
if configuration = Pleroma.Config.get([:frontends, frontend_type]) do
instance_static_path = Pleroma.Config.get([:instance, :static_dir], "instance/static")
@@ -55,10 +53,13 @@ defmodule Pleroma.Web.Plugs.FrontendStatic do
defp invalid_path?([h | t], match), do: String.contains?(h, match) or invalid_path?(t)
defp invalid_path?([], _match), do: false
- defp api_route?([h | _]) when h in @api_routes, do: true
- defp api_route?([_ | t]), do: api_route?(t)
defp api_route?([]), do: false
+ defp api_route?([h | t]) do
+ api_routes = Pleroma.Web.Router.get_api_routes()
+ if h in api_routes, do: true, else: api_route?(t)
+ end
+
defp call_static(conn, opts, from) do
opts = Map.put(opts, :from, from)
Plug.Static.call(conn, opts)