diff options
Diffstat (limited to 'lib/pleroma/web/frontend_controller.ex')
-rw-r--r-- | lib/pleroma/web/frontend_controller.ex | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/lib/pleroma/web/frontend_controller.ex b/lib/pleroma/web/frontend_controller.ex index 2ba445df9..b5dc41503 100644 --- a/lib/pleroma/web/frontend_controller.ex +++ b/lib/pleroma/web/frontend_controller.ex @@ -35,42 +35,4 @@ defmodule Pleroma.Web.FrontendController do |> put_view(Phoenix.Controller.__view__(controller)) |> controller.call(controller.init(action)) end - - @doc """ - Returns path to index.html file for the frontend from the given config. - If config is not provided, config for the `:primary` frontend is fetched and used. - If index.html file is not found for the requested frontend, the function fallback - to looking the file at instance static directory and then, in case of failure, - in priv/static directory. - Path returned in case of success is guaranteed to be existing file. - """ - @spec index_file_path(Map.t()) :: {:ok, String.t()} | {:error, String.t()} - def index_file_path(fe_config \\ nil) do - filename = "index.html" - instance_base_path = Pleroma.Config.get([:instance, :static_dir], "instance/static/") - - %{"name" => name, "ref" => ref} = - with nil <- fe_config do - Pleroma.Frontend.get_primary_fe_opts()[:config] - end - - frontend_path = Path.join([instance_base_path, "frontends", name, ref, filename]) - instance_path = Path.join([instance_base_path, filename]) - priv_path = Application.app_dir(:pleroma, ["priv", "static", filename]) - - cond do - File.exists?(instance_path) -> - {:ok, instance_path} - - File.exists?(frontend_path) -> - {:ok, frontend_path} - - File.exists?(priv_path) -> - {:ok, priv_path} - - true -> - {:error, - "index.html file was not found in #{inspect([instance_path, frontend_path, priv_path])}"} - end - end end |