mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-14 05:04:49 +00:00
correct pool and uniform headers format
This commit is contained in:
parent
5e8adf91b4
commit
79f65b4374
6 changed files with 14 additions and 10 deletions
|
@ -124,7 +124,9 @@ defmodule Mix.Tasks.Pleroma.Frontend do
|
||||||
url = String.replace(frontend_info["build_url"], "${ref}", frontend_info["ref"])
|
url = String.replace(frontend_info["build_url"], "${ref}", frontend_info["ref"])
|
||||||
|
|
||||||
with {:ok, %{status: 200, body: zip_body}} <-
|
with {:ok, %{status: 200, body: zip_body}} <-
|
||||||
Pleroma.HTTP.get(url, [], timeout: 120_000, recv_timeout: 120_000) do
|
Pleroma.HTTP.get(url, [],
|
||||||
|
adapter: [pool: :media, timeout: 120_000, recv_timeout: 120_000]
|
||||||
|
) do
|
||||||
unzip(zip_body, dest)
|
unzip(zip_body, dest)
|
||||||
else
|
else
|
||||||
e -> {:error, e}
|
e -> {:error, e}
|
||||||
|
|
|
@ -150,7 +150,9 @@ defmodule Pleroma.Instances.Instance do
|
||||||
defp scrape_favicon(%URI{} = instance_uri) do
|
defp scrape_favicon(%URI{} = instance_uri) do
|
||||||
try do
|
try do
|
||||||
with {:ok, %Tesla.Env{body: html}} <-
|
with {:ok, %Tesla.Env{body: html}} <-
|
||||||
Pleroma.HTTP.get(to_string(instance_uri), [{:Accept, "text/html"}]),
|
Pleroma.HTTP.get(to_string(instance_uri), [{"accept", "text/html"}],
|
||||||
|
adapter: [pool: :media]
|
||||||
|
),
|
||||||
favicon_rel <-
|
favicon_rel <-
|
||||||
html
|
html
|
||||||
|> Floki.parse_document!()
|
|> Floki.parse_document!()
|
||||||
|
|
|
@ -164,12 +164,12 @@ defmodule Pleroma.Object.Fetcher do
|
||||||
date: date
|
date: date
|
||||||
})
|
})
|
||||||
|
|
||||||
[{"signature", signature}]
|
{"signature", signature}
|
||||||
end
|
end
|
||||||
|
|
||||||
defp sign_fetch(headers, id, date) do
|
defp sign_fetch(headers, id, date) do
|
||||||
if Pleroma.Config.get([:activitypub, :sign_object_fetches]) do
|
if Pleroma.Config.get([:activitypub, :sign_object_fetches]) do
|
||||||
headers ++ make_signature(id, date)
|
[make_signature(id, date) | headers]
|
||||||
else
|
else
|
||||||
headers
|
headers
|
||||||
end
|
end
|
||||||
|
@ -177,7 +177,7 @@ defmodule Pleroma.Object.Fetcher do
|
||||||
|
|
||||||
defp maybe_date_fetch(headers, date) do
|
defp maybe_date_fetch(headers, date) do
|
||||||
if Pleroma.Config.get([:activitypub, :sign_object_fetches]) do
|
if Pleroma.Config.get([:activitypub, :sign_object_fetches]) do
|
||||||
headers ++ [{"date", date}]
|
[{"date", date} | headers]
|
||||||
else
|
else
|
||||||
headers
|
headers
|
||||||
end
|
end
|
||||||
|
|
|
@ -96,6 +96,6 @@ defmodule Pleroma.Web.RichMedia.Helpers do
|
||||||
@rich_media_options
|
@rich_media_options
|
||||||
end
|
end
|
||||||
|
|
||||||
Pleroma.HTTP.get(url, headers, options)
|
Pleroma.HTTP.get(url, headers, adapter: options)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -136,12 +136,12 @@ defmodule Pleroma.Web.WebFinger do
|
||||||
|
|
||||||
def find_lrdd_template(domain) do
|
def find_lrdd_template(domain) do
|
||||||
with {:ok, %{status: status, body: body}} when status in 200..299 <-
|
with {:ok, %{status: status, body: body}} when status in 200..299 <-
|
||||||
HTTP.get("http://#{domain}/.well-known/host-meta", []) do
|
HTTP.get("http://#{domain}/.well-known/host-meta") do
|
||||||
get_template_from_xml(body)
|
get_template_from_xml(body)
|
||||||
else
|
else
|
||||||
_ ->
|
_ ->
|
||||||
with {:ok, %{body: body, status: status}} when status in 200..299 <-
|
with {:ok, %{body: body, status: status}} when status in 200..299 <-
|
||||||
HTTP.get("https://#{domain}/.well-known/host-meta", []) do
|
HTTP.get("https://#{domain}/.well-known/host-meta") do
|
||||||
get_template_from_xml(body)
|
get_template_from_xml(body)
|
||||||
else
|
else
|
||||||
e -> {:error, "Can't find LRDD template: #{inspect(e)}"}
|
e -> {:error, "Can't find LRDD template: #{inspect(e)}"}
|
||||||
|
|
|
@ -1350,11 +1350,11 @@ defmodule HttpRequestMock do
|
||||||
{:ok, %Tesla.Env{status: 200, body: File.read!("test/fixtures/relay/relay.json")}}
|
{:ok, %Tesla.Env{status: 200, body: File.read!("test/fixtures/relay/relay.json")}}
|
||||||
end
|
end
|
||||||
|
|
||||||
def get("http://localhost:4001/", _, "", Accept: "text/html") do
|
def get("http://localhost:4001/", _, "", [{"accept", "text/html"}]) do
|
||||||
{:ok, %Tesla.Env{status: 200, body: File.read!("test/fixtures/tesla_mock/7369654.html")}}
|
{:ok, %Tesla.Env{status: 200, body: File.read!("test/fixtures/tesla_mock/7369654.html")}}
|
||||||
end
|
end
|
||||||
|
|
||||||
def get("https://osada.macgirvin.com/", _, "", Accept: "text/html") do
|
def get("https://osada.macgirvin.com/", _, "", [{"accept", "text/html"}]) do
|
||||||
{:ok,
|
{:ok,
|
||||||
%Tesla.Env{
|
%Tesla.Env{
|
||||||
status: 200,
|
status: 200,
|
||||||
|
|
Loading…
Reference in a new issue