X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Ffrontend.ex;h=dc9d55646c9a949e206a57a78ccfda39f6ca0918;hb=eb1b9c415510a9a5a74e413fc32d823e02afe47d;hp=3413d2fbad1dd2c8ab156344e025c6bce789feb3;hpb=03e306785b2013fe6fd47b59d4e578c6ed586b08;p=akkoma
diff --git a/lib/pleroma/frontend.ex b/lib/pleroma/frontend.ex
index 3413d2fba..dc9d55646 100644
--- a/lib/pleroma/frontend.ex
+++ b/lib/pleroma/frontend.ex
@@ -1,5 +1,5 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors
+# Copyright © 2017-2021 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Frontend do
@@ -8,16 +8,16 @@ defmodule Pleroma.Frontend do
require Logger
def install(name, opts \\ []) do
- cmd_frontend_info = %{
+ frontend_info = %{
"ref" => opts[:ref],
"build_url" => opts[:build_url],
"build_dir" => opts[:build_dir]
}
- config_frontend_info = Config.get([:frontends, :available, name], %{})
-
frontend_info =
- Map.merge(config_frontend_info, cmd_frontend_info, fn _key, config, cmd ->
+ [:frontends, :available, name]
+ |> Config.get(%{})
+ |> Map.merge(frontend_info, fn _key, config, cmd ->
# This only overrides things that are actually set
cmd || config
end)
@@ -32,19 +32,22 @@ defmodule Pleroma.Frontend do
label = "#{name} (#{ref})"
tmp_dir = Path.join(dir(), "tmp")
+ IO.puts("Downloading #{label}...")
with {_, :ok} <-
{:download_or_unzip, download_or_unzip(frontend_info, tmp_dir, opts[:file])},
- Logger.info("Installing #{label} to #{dest}"),
+ IO.puts("Installing #{label} to #{dest}"),
:ok <- install_frontend(frontend_info, tmp_dir, dest) do
File.rm_rf!(tmp_dir)
- Logger.info("Frontend #{label} installed to #{dest}")
+ IO.puts("Frontend #{label} installed to #{dest}")
else
{:download_or_unzip, _} ->
- Logger.info("Could not download or unzip the frontend")
+ IO.puts("Could not download or unzip the frontend")
+ {:error, "Could not download or unzip the frontend"}
_e ->
- Logger.info("Could not install the frontend")
+ IO.puts("Could not install the frontend")
+ {:error, "Could not install the frontend"}
end
end
@@ -90,7 +93,7 @@ defmodule Pleroma.Frontend do
url = String.replace(frontend_info["build_url"], "${ref}", frontend_info["ref"])
with {:ok, %{status: 200, body: zip_body}} <-
- Pleroma.HTTP.get(url, [], pool: :media, recv_timeout: 120_000) do
+ Pleroma.HTTP.get(url, [], receive_timeout: 120_000) do
unzip(zip_body, dest)
else
{:error, e} -> {:error, e}