Commit 75b94a2f authored by feld's avatar feld
Browse files

Merge branch 'cycles-frontend-static' into 'develop'

Recompilation speedup: make Router a runtime dep of FrontendStatic

See merge request !3429
parents 0ddf492c 595bca24
Pipeline #36272 passed with stages
in 84 minutes and 57 seconds
......@@ -10,8 +10,6 @@ defmodule Pleroma.Web.Plugs.FrontendStatic do
@behaviour Plug
@api_routes Pleroma.Web.Router.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 @@ defp invalid_path?([h | _], _match) when h in [".", "..", ""], do: true
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)
defp call_static(conn, opts, from) do
opts = Map.put(opts, :from, from), opts)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment