Merge branch 'tesla-get-to-pleroma' into 'develop'
Use Pleroma.HTTP instead of Tesla Closes #2275 See merge request pleroma/pleroma!3113
This commit is contained in:
parent
fb0e340363
commit
fa6ad67397
|
@ -10,7 +10,7 @@ defmodule Pleroma.Captcha.Kocaptcha do
|
||||||
def new do
|
def new do
|
||||||
endpoint = Pleroma.Config.get!([__MODULE__, :endpoint])
|
endpoint = Pleroma.Config.get!([__MODULE__, :endpoint])
|
||||||
|
|
||||||
case Tesla.get(endpoint <> "/new") do
|
case Pleroma.HTTP.get(endpoint <> "/new") do
|
||||||
{:error, _} ->
|
{:error, _} ->
|
||||||
%{error: :kocaptcha_service_unavailable}
|
%{error: :kocaptcha_service_unavailable}
|
||||||
|
|
||||||
|
|
|
@ -594,7 +594,7 @@ defp fetch_pack_info(remote_pack, uri, name) do
|
||||||
end
|
end
|
||||||
|
|
||||||
defp download_archive(url, sha) do
|
defp download_archive(url, sha) do
|
||||||
with {:ok, %{body: archive}} <- Tesla.get(url) do
|
with {:ok, %{body: archive}} <- Pleroma.HTTP.get(url) do
|
||||||
if Base.decode16!(sha) == :crypto.hash(:sha256, archive) do
|
if Base.decode16!(sha) == :crypto.hash(:sha256, archive) do
|
||||||
{:ok, archive}
|
{:ok, archive}
|
||||||
else
|
else
|
||||||
|
@ -617,7 +617,7 @@ defp fallback_sha_changed?(pack, data) do
|
||||||
end
|
end
|
||||||
|
|
||||||
defp update_sha_and_save_metadata(pack, data) do
|
defp update_sha_and_save_metadata(pack, data) do
|
||||||
with {:ok, %{body: zip}} <- Tesla.get(data[:"fallback-src"]),
|
with {:ok, %{body: zip}} <- Pleroma.HTTP.get(data[:"fallback-src"]),
|
||||||
:ok <- validate_has_all_files(pack, zip) do
|
:ok <- validate_has_all_files(pack, zip) do
|
||||||
fallback_sha = :sha256 |> :crypto.hash(zip) |> Base.encode16()
|
fallback_sha = :sha256 |> :crypto.hash(zip) |> Base.encode16()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue